I also want to get rid of the search option on the navigation bar. So I found what seems like a really nice, portable button configuration online. The idea is that the click events for custom navigation buttons are functions in a separate module.
But there is a quirk. After starting a new record the Previous button skips the most recently saved record. E.g. if I create and save 2 records then I’m working on a third, the Previous button skips to record 1 instead of going to record 2. Likewise, if I’ve started record 4 the button skips to record 2. After that I can scroll backward and forward hitting all the records.
The code for the Previous function is below. I added the first bit about undoing the current record because the 'Save & Next' action pre-populates the new record with the same patient and volunteer as the last record, so you can’t browse backward without certain required data.
Code: Select all
Public Function GoToPrevious() If Screen.ActiveForm.NewRecord Then Screen.ActiveForm.Undo On Error GoTo OnFirstRecord Screen.ActiveForm.AllowAdditions = False DoCmd.RunCommand acCmdRecordsGoToPrevious GoTo WayOut OnFirstRecord: MsgBox "You're on the first record" WayOut: On Error GoTo 0 End Function