Many thanks to @CJ_London for alerting me to this thread
I've seen variations on this issue over the years where adding breakpoints prevents code running, but until today had never really studied the issues.
I've just alerted the Access team to this issue but I expect they are already aware as this particular problem has existed since at least A2003 (A2000 is fine / A2002 not tested)
I created my own test databases to check that the issue wasn't specific to your own db.
I then added various navigation buttons with code like this
Code:
Private Sub cmdLast_Click() MsgBox "Last" 'add breakpoint
' DoCmd.OpenForm Me.Name, acNormal 'disable in testing
DoCmd.GoToRecord , , acLast
End Sub
I then added a breakpoint before the GoToRecord code – in this case on the MsgBox line
From A2003 onwards, the code errors on the GoToRecord line:
A365: error 2499 - You can't use the GoToRecord or SearchForRecord action or method on an object in Design view.
A2003/2007/2010: error 2046 - The command or action GoToRecord isn't available now.
A2000: No error!
The breakpoint causes the form to behave as though it is in 'design view'
FIXES:
1. Enable the line DoCmd.OpenForm Me.Name, acNormal. No error
2. Set Popup = No. No error. No need to specify Form view
3. Use A2000 (a bit extreme, methinks!)
Repro databases (ACCDB & A2000 MDB) attached
NOTE: the issue depends on the Access version NOT the file format