New Record Button

stevemccauley

Registered User.
Local time
Today, 19:22
Joined
Aug 8, 2001
Messages
75
What code do I have to enter to have a button on my form, when pressed, move to a new record?
 
Steve

You could use this code

Private Sub CmdAddNewRec_Click()
On Error GoTo Err_CmdAddNewRec_Click


DoCmd.GoToRecord , , acNewRec

Exit_CmdAddNewRec_Click:
Exit Sub

Err_CmdAddNewRec_Click:
MsgBox Err.Description
Resume Exit_CmdAddNewRec_Click

End Sub

If you just put a cmd button on your form by using the wizard access will generate the above code anyway.

HTH
Hay
 
Event code for New Record

I concur with Hayley's suggestion...

the code there is what Access puts into the OnClick event when you build the button using the wizard.
 

Users who are viewing this thread

Back
Top Bottom