8 replies
by syscokid
You need to get some kind of a counter in there, then DO WHILE counter > 0.
Sorry, I can't give you exact code (not a VBA guru, just a dabbler). :)
by mra2
by donq
It sounds as if you import records from the same table (AllDue) several times a month. If this is so and you allow Access to name your imports you wind up with what you have - multiple small tables with the same name + an integer concatenated on behind. BAD PRACTICE.....
Suggestion: Delete all records from inside one of the tables you need to discard and Change it's name to "PastDue". PastDue is now structured to match all imports from AllDue 100% - Now make PastDue your Target Table for an Append Query and use each AllDue (disk) as the record source (I assume the key fields are imported as well?). Just use your disk copies of AllDue as the record source and save everything to PastDue on the hard drive. Then once a month (or whenever maintenance dictates) write a Procedure to archive everything and clear the table, or write a Delete Query to clear all records. Click, click and you are done.
If that won't work write a Make Table query from the First "append" you do and name its data target PastDue. If you need more help (and you can read Access 2000) I would be more than happy to send you some code samples.
Hope this helps and good luck - Don Quigg, databyte@mindspring.com
by mra2
by mbarker734
This is as simple as I can make it.
Insert the following code where you want to perform the table deletion (I tested it using a Command Button).
Dim dbsName As Database
Dim tdfloop As TableDef
Set dbsName = OpenDatabase("mydatabase.mdb")
With dbsName
For Each tdfloop In .TableDefs
If tdfloop.Name = "Alldue1" Then DoCmd.DeleteObject acTable, tdfloop.Name
If tdfloop.Name = "Alldue2" Then DoCmd.DeleteObject acTable, tdfloop.Name
If tdfloop.Name = "Alldue3" Then DoCmd.DeleteObject acTable, tdfloop.Name
If tdfloop.Name = "Alldue15" Then DoCmd.DeleteObject acTable, tdfloop.Name
'Continue with one if statement for each table you want to delete
Next tdfloop
End With
Hope this helpsyou,
Mark
by mbarker734
by mra2
by mra2
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending