Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
BTW I was just using your DB for testing something and I spotted this for add new record?
AFAIK you would need to check Err.Number not macroerror if using vba ?Code:Private Sub btnAddNew_Click() On Error GoTo btnAddNew_Click_Err On Error Resume Next DoCmd.GoToRecord , "", acNewRec Me.DhrNum.SetFocus If (MacroError <> 0) Then Beep MsgBox MacroError.Description, vbOKOnly, "" End If btnAddNew_Click_Exit: Exit Sub btnAddNew_Click_Err: MsgBox Error$ Resume btnAddNew_Click_Exit End Sub
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Welshgasman,
Thanks for spotting that, I am not very VB literate and If I add a button with the wizard I then usually convert them to VB which Access does when you ask it to and apparently it leaves the MacroError in there.
I do have to become more VB Literate, I could never have spotted that.
Thanks
Dave
Also each On Error supercedes the previous statement?, so you would not get to Click_ErrWelshgasman,
Thanks for spotting that, I am not very VB literate and If I add a button with the wizard I then usually convert them to VB which Access does when you ask it to and apparently it leaves the MacroError in there.
I do have to become more VB Literate, I could never have spotted that.
Thanks
Dave
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
One would think that Access would do a better job of converting the Macros.
Many thanks for you assistance, it worked like a charm.