Your best bet is to disable the controls rather than report an error. You should disable the move first and move previous buttons if on the first record and the last and next buttons on the last record. Diabling the New record button when on a new record also makes sense.
The basic approach is to create a recordset variable and set it equal to the current form recordsetclone. Move the recordset variable to the previous record (docmd.move....) and test if it is EOF or BOF and enable the buttons accordingly. If it is not EOF or BOF, set the Form's recordset.bookmark equal to the recordsetclone.bookmark and the form will navigate as directed, only when not EOF or BOF. You don't need to even pop a message, just don't run the move code.
If you only want to write this code once, create a form with the 5 navigation buttons and the record number textbox plus a label showing the record count. Turn off record selectors and lines and all that stuff and now you can drop this form on all your forms as a sub form. Write the code on the sub form to work off of Me.Parent.Recordsetclone. You can set the textbox to the Me.Parent.recordset.absoluteposition and the label.caption to the me.Parent.recordset.recordcount.
(Instead of all this me.parent.recordset mumbo jumbo, create module level variables for parent recordset and recordsetclone and call a public procedure on the subform that sets them from the parent open event (If I recall correctly, the subform open event runs before the parent form open event so there is no parent in existence when the subform opens). There is a way to do this as I have done it in the past. The result is a new 'control' that has all the events hooked up to work with any form from which you call its init method. It probably just works if you do it on the on current event but it is more efficient to call the procedure that initializes the navigation controls in one of the open events.
Ciao
Jürgen Welz
Edmonton AB Canada
[email protected]