OnClick event for button

  • Thread starter Thread starter LJB
  • Start date Start date
L

LJB

I placed a button on a form, telling it on the OnClick event to create a new
record. When I click on the button, it creates a new record but loses its
focus. I would like it to not only create the new record but to also go to
the first field on the form so that the users can just continue entering the
new record. How would I do that?

Private Sub CmdNewRecord_Click()
On Error GoTo Err_CmdNewRecord_Click


DoCmd.GoToRecord , , acNewRec



Exit_CmdNewRecord_Click:
Exit Sub

Err_CmdNewRecord_Click:
MsgBox Err.Description
Resume Exit_CmdNewRecord_Click

End Sub

Thanks, anyone, for your help!
 
PERFECT!!

Thank you, Alex, for taking the time to answer, you just possibly saved
what's left of my sanity, lol!

LJB
 
Back
Top