I have an unbound form with buttons on it for performing different operation. I have an unbound combo box and a button that opens my main contact form to the record matching the choice in the combo box. Works great. Now I want a "new record" button that opens the same contact form, but to a new (blank) record.
I need the vba code for the onclick event of this command button.
Thanks
Open form to new record
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Open form to new record
Try this:
where frmContacts is the form to open.
Code: Select all
Private Sub cmdNewRecord_Click()
DoCmd.OpenForm FormName:="frmContacts", DataMode:=acFormAdd
End Sub
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 198
- Joined: 21 Aug 2011, 02:32
Re: Open form to new record
Yup! That did the trick. ThanksHansV wrote:Try this:
where frmContacts is the form to open.Code: Select all
Private Sub cmdNewRecord_Click() DoCmd.OpenForm FormName:="frmContacts", DataMode:=acFormAdd End Sub