Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3218, Access 97 vs. 2000

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I run a procedure on a linked table on a network drive to delete all records and then add new records from a text file. The program works great as long as the data file is in Access 97, When I convert it to Access2000 I get "Could not Update; Currently Locked" error 3218.

Here is the code:

Set dbInput = CurrentDb()
Set rsInput = dbInput.OpenRecordset(strTableName, dbOpenDynaset)

If rsInput.BOF = False Then rsInput.MoveFirst
Do While rsInput.EOF = False
rsInput.Delete
rsInput.MoveNext
Loop

What am I doing Wrong?
 
The line:

If rsInput.BOF = False Then rsInput.MoveFirst

is wrong, and shouldn't work, even in '97.

try: If rsInput.EOF = False Then rsInput.MoveFirst

rsInput.BOF should ALWAYS be true when you open a new
recordset, and thus never go to a new record.

try putting a DoEvents into the code, before you start
adding records, to allow the other update to complete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top