Deleting more than 50,000 in macro (1 Viewer)

Wonderer

Registered User.
Local time
Today, 23:02
Joined
Sep 12, 2001
Messages
16
Wondering if anyone can help...

I have checked the search but no joy..

I have a simple macro that opens table and selects all then delets the contense as i need to keep the table struture however this table has roughly 106,000 records i need to delet them all regularly. But get errors as i am aware this is over the possible max for deleting

Does anyone know a way round this for example by selecting 1-50,000 and so forth

Any help would be appreciated!!

Thanks
 

ColinEssex

Old registered user
Local time
Today, 23:02
Joined
Feb 22, 2002
Messages
9,116
If the table contains dates why not use parameters in the query to only delete specific date ranges.

Col
:cool:
 

Wonderer

Registered User.
Local time
Today, 23:02
Joined
Sep 12, 2001
Messages
16
Good idea but no date ranges any other thoughts?

Regards

ROb
 

ColinEssex

Old registered user
Local time
Today, 23:02
Joined
Feb 22, 2002
Messages
9,116
Any field will do ID_No for example or in the query set the Top n % like 25%

Col
 

Wonderer

Registered User.
Local time
Today, 23:02
Joined
Sep 12, 2001
Messages
16
Thanks col for your response

Where should i put this condition?

Thanks

Rob
 

Tim K.

Registered User.
Local time
Today, 23:02
Joined
Aug 1, 2002
Messages
242
I would use VBA to delete the table. Fast.

Try this.

Code:
Private Sub Command0_Click()
Dim dbs As Database
Set dbs = CurrentDb
dbs.Execute "Delete * From YourTargetTableNameHere"
dbs.Close
Set dbs = Nothing
End Sub
 

ghudson

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2002
Messages
6,195
How about...

Private Sub Command0_Click()
Currentdb().Execute "DELETE * FROM YourTargetTableNameHere"
End Sub

...for the same result minus a few lines of code?
 

Users who are viewing this thread

Top Bottom