RichardMGreen
Well-known Member
- Joined
- Feb 20, 2006
- Messages
- 2,177
Hi all
I've got a piece of code I inherited that deletes some tables from a database before importing updated versions (I'm trying to get an append query to work but I'm struggling with the downloads).
At the moment it uses an on error event to just continue regardless but I'd like to make it a bit tidier.
This is the code I have:-
What I would like to do is test for the existense of each table in turn before doing the delete and remove the on error event completely.
I'll admit to the fact that my Access VBA knowledge is next to nil so any help would be greatly appreciated.
I've got a piece of code I inherited that deletes some tables from a database before importing updated versions (I'm trying to get an append query to work but I'm struggling with the downloads).
At the moment it uses an on error event to just continue regardless but I'd like to make it a bit tidier.
This is the code I have:-
Code:
On Error Resume Next
DoCmd.DeleteObject acTable, "ext_Activities"
DoCmd.DeleteObject acTable, "ext_HTs"
DoCmd.DeleteObject acTable, "ext_Clients"
DoCmd.DeleteObject acTable, "ext_Assessments"
DoCmd.DeleteObject acTable, "ext_Contacts"
DoCmd.DeleteObject acTable, "ext_Wellbeing"
DoCmd.DeleteObject acTable, "ext_PHPGoals"
DoCmd.DeleteObject acTable, "ext_PostAssessments"
DoCmd.DeleteObject acTable, "ext_Reviews"
DoCmd.DeleteObject acTable, "ext_Maintenance"
DoCmd.DeleteObject acTable, "ext_Deprived"
What I would like to do is test for the existense of each table in turn before doing the delete and remove the on error event completely.
I'll admit to the fact that my Access VBA knowledge is next to nil so any help would be greatly appreciated.