Deleting records ready for a New import

Gareth50

Registered User.
Local time
Today, 15:32
Joined
Oct 26, 2002
Messages
10
Dear all

Could anyone provide me with a section of VBA code (module) that will carry out the following in one procedure:

Open an existing table - called 'Students'
Select and delete all the records leaving just the structure (preferably WITHOUT a request to confirm)
Close the table ready for an append query to add new data to the table.

Thanks in advance

Gareth
 
Gareth

You can use the following to delete all from the students table and then run your append. This can be done from a command button on one of your forms:

Code:
Private Sub [YourCommandButton]_Click()
'Turn off Warnings
DoCmd.SetWarnings False
'Run Delete Statement
DoCmd.RunSQL "Delete * From Students"
'Run append Statement or change to run append query
DoCmd.RunSQL "YourAppendGoesHere"
'Turn Warnings back on
DoCmd.SetWarnings True
End Sub

HTH

Graham
 

Users who are viewing this thread

Back
Top Bottom