|
-
Jul 31st, 2006, 12:15 PM
#1
Thread Starter
Junior Member
Problem with VBA Access - lock files
Hi
I have a problem deleting table thru VBA. Here's how I do it :
VB Code:
t_file.Open "File", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
If t_file.EOF = False Then
Do
t_file.Delete
t_file.MoveNext
Loop Until t_file.EOF
End If
t_file.Close
Set t_file = Nothing
The problem is that if the table is too big, it tells me that the number of lock file is too big. Is there another way or a problem with what I am doing.
Thanks for helping
-
Jul 31st, 2006, 12:21 PM
#2
Re: Problem with VBA Access - lock files
Moved to Office Development
-
Jul 31st, 2006, 01:06 PM
#3
Member
Re: Problem with VBA Access - lock files
I would just check to see if the table is empty, like you did, and if it is not, then call
VB Code:
DoCmd.RunSQL "DELETE * FROM File"
instead of deleting it record by record.
-
Jul 31st, 2006, 01:09 PM
#4
Re: Problem with VBA Access - lock files
If you want to delete the entire table, you can do something like this where oConn is your connection:
VB Code:
sSQL = "DROP TABLE table_name;"
oConn.Execute sSQL
If you just want to wipe all the records in the table, something like this:
VB Code:
sSQL = "DELETE * FROM table_name;"
oConn.Execute sSQL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|