Prevent Next Record command button from advancing MS Access
Posted on 2012-09-08
I have an access form with a textbox on it that displays the [record number] field from MyTable. I also have a Next Record command button on the form. Currently, the Next Record button is using the macro code that is automatically generated when you place a command button on a form. I have 10 records in my table. If I repeatedly click the button, it advances through the records. When I am on record 10 and click the Next Record button, it advances to the next record (a blank record) without a message. If I click the Next Record button again, then an error message pops up indicating "You can't go to the specified record". I don't want this. What I want is for the program to not advance past record 10. So, let's say I'm on record 10 and I click the Next Record button. It's there that I want a message to pop up saying something like "You have reached the last record" or whatever and for it to stay on record 10. I don't want it advancing beyond record 10 (or if I change the number of records, the last record in the table that has data in it). Thanks.