OnClick event for button

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!
 
L

LJB

PERFECT!!

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

LJB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top