errase query in a form

  • Thread starter Thread starter Rodrigo Carvalho
  • Start date Start date
R

Rodrigo Carvalho

I need a way to erase all the records in certain tables. I
was able to do this by using the "delete query". However,
since the tables are independent I was not able to make
one "delete query" to errase the records of multiple
unrelated tables at the same time. How can I do this?

Also, I need a way to have a button in a Form that will
errase all the data from these certain tables. For some
reason when I try to add an action button to a form it
won't let me choose a "delete query".

I will greatly appreciate the help
Thank you
 
To delete all records from MyTable:
Dim strSQL As String
strSQL = "DELETE FROM MyTable;"
dbEngine(0)(0).Execute strSQL, dbFailOnError
 
Thanks, but this didn't help much. I am new to access so I
don't know what to do with the command you sent me. I
tried writting it in "modules" but it didn't work. Please
help.
 
1. Open your form in design view.

2. Right-click your command button, and choose Properties.

3. Set the On Click property (on the Event tab) to:
[Event Procedure]

4. Click the Build button (...) beside this. Access opens the code window.

5. Paste the lines between the "Private Sub ..." and "End Sub" lines.
 
Back
Top