Link to home
Start Free TrialLog in
Avatar of mortensencs
mortensencsFlag for United States of America

asked on

Last Record not working

I have an access database which I use the built in, First, Previous, Next and Last record buttons to access the records individually as needed.  For some reason, there was a record that was deleted.  It went from primary key 469 to 471.
This has caused the database to think that record 469 is the last record, when there are many more after that.
SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mortensencs

ASKER

If I go into the table, there are records beyond record 469, it goes to about 570, but the controls are seeming to stop at 469.  If I look at the record count at the bottom of the database, it shows it's record 528 and If I click to go to the next record, it switches to record, 529, 530 and 531

Thanks in advance
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you mean that the record numbers in the navigation buttons are different to the primary key values then that is normal.
The record counter at the bottom left is just that - a counter.  It has nothing to do with any values in the records.  The record counter would still operate if there was no number key in the record.

If you have used an autonumber field for your ID then you will have gaps in the number sequence where IDs have been used but either deleted or never saved.  So the counter and the id are quite independent.  You can easily see this if you sort the records into a different sequence.  The record counter will still run from 1 to the however many records there are.  

It appears I misread the question. However, the code snippet I provided does give the questioner a means to "skip" deleted or uncreated records..
Emil Gray:  I think that will help solve the problem, deleted records seem to be the problem, something I have figured out is there is a one to many relationship between the first and second table, it seems that when the "Save" button is used, it causes the next record button to show the record as many times as the save button is used.  I will try adding that code to skip to the next record, I think that will help solve the problem.
Thank you for your assistance!!