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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Multiple records using DAO 1

Status
Not open for further replies.

Joshy

Programmer
Mar 8, 2001
14
0
0
CA
Ok, I got the following code: (with the DAO 3.6 as reference)

Public Sub DeletingRecords ()

Dim db as Database
Dim rec as Recordset

Set db = CurrentDb ()
Set rec = db.OpenRecordSet ("tblResult")

For intX = 1 to 24
rec.Delete
Next

... ...
... ...

rec.Close

End Sub

I get a run time error (at "rec.Delete"), the database can't seem to delete more than one record at a time (the records are stored in a table) But I'm trying to delete the records within a 'For... Next' loop, what can I do??
any help would be greatly appreciated :)
Josh
 
You need to add
rec.movenext
to advance to the next record in the recordset. Mike Rohde
rohdem@marshallengines.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top