Hi
Can anybody tell me why the VBA code below works fine in Access 2003
but doesn't work in Access 2007? I do not get any error message, even
if I put a deliberate error into the code. Also, if I put a debug
break point in the code, nothing happens. If I add the line msgbox
"ok" it displays the message box, so I know that it is reading the
code. This is a frightening problem, because if this doesn't display
errors, then what other bits of code are not working? This is
happening on every PC which has Access 2007.
Here's what should happen - when the user clicks on a list box, it
takes the value from the item he has clicked on and goes off and finds
the record which corresponds with the value.
Private Sub lstCompany_Clic k()
On Error GoTo err_handler
DoCmd.GoToRecor d acActiveDataObj ect, , acFirst
txtNAME.Locked = False
txtNAME.SetFocu s
DoCmd.FindRecor d lstCompany.Colu mn(0), acAnywhere, False, , False,
acCurrent, False
txtFindCompany. SetFocus
txtNAME.Locked = True
txtFindCompany. SetFocus
Exit Sub
err_handler:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
Thanks a lot for any help
Colin
Can anybody tell me why the VBA code below works fine in Access 2003
but doesn't work in Access 2007? I do not get any error message, even
if I put a deliberate error into the code. Also, if I put a debug
break point in the code, nothing happens. If I add the line msgbox
"ok" it displays the message box, so I know that it is reading the
code. This is a frightening problem, because if this doesn't display
errors, then what other bits of code are not working? This is
happening on every PC which has Access 2007.
Here's what should happen - when the user clicks on a list box, it
takes the value from the item he has clicked on and goes off and finds
the record which corresponds with the value.
Private Sub lstCompany_Clic k()
On Error GoTo err_handler
DoCmd.GoToRecor d acActiveDataObj ect, , acFirst
txtNAME.Locked = False
txtNAME.SetFocu s
DoCmd.FindRecor d lstCompany.Colu mn(0), acAnywhere, False, , False,
acCurrent, False
txtFindCompany. SetFocus
txtNAME.Locked = True
txtFindCompany. SetFocus
Exit Sub
err_handler:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
Thanks a lot for any help
Colin
Comment