Hello friends, I want to clear a table by clicking a button on a form. I have created the query to clear the table but I cannot make it the source for the command button on the form. Is this possible? Thanks for your time and help.

I'm sure there is a VBA approach to this, but you could also make a macro with 6 lines in it.

Make a new Macro and use the following:

SetWarnings = No
OpenTable = table you want to remove all records from
RunCommand = SelectAllRecords
RunCommand = DeleteRecord
Close = choose table and specify table you just opened
SetWarnings = Yes


After the macro is made, make a command button and assign the macro to it.

No need to use a query to do this.

Good luck

commented: Thanks for the help. +1

Many thanks, it worked just as I wanted it to!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.