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

Problem with a MoveLast command

Status
Not open for further replies.

GavC

Programmer
May 31, 2001
8
NZ
I was using this code successfully to move to the last recordset in an Access table

Set rsStudents = dbSJS1.OpenRecordset("Students", dbOpenTable)
rsStudents.MoveLast
txtIDNumber = rsStudents("ID Number") + 1

(to display what the current record will be numbered, once Updated), when out of the blue it won't move past record 77, even though I now have 85 records. Now it tells me each new record will be numbered 78, even though AutoNumber is still adding new records with no problem.

Does anyone know why this is?
Thanks,
Gav.
 
Did you try to refresh the recordset before you go to the last record?

Set rsStudents = dbSJS1.OpenRecordset("Students", dbOpenTable)
rsStudents.Requery
rsStudents.MoveLast

Hope this helps
 
I found the answer to this problem.
Tools>Database Utilities>Repair Database &
Tools>Database Utilities>Compact Database
Which clears any dead or malfunctioning records from the database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top