Open Form in new record docmd.goto acNewRec

pkarnowski

New Member
Joined
May 12, 2004
Messages
15
I still can't get this to work, I have tried adding it to the on open [event procedure] but get errors. Where do I add it?

Private Sub Form_Open(Cancel As Integer)
docmd.goto acNewRec
End Sub

This is what it looks like when I add it.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If you ALWAYS want the form to open on a new record, go to the Properties of the form and change Add to True.

Denis
 
Upvote 0
Paul, I'm at work at the moment and don't have Access on this machine -- I may have remebered the item incorrectly. I'll get back to you when I've checked it out.

Denis
 
Upvote 0
Paul, I dug through my resources and the Help section, and it was very unhelpful. Basically, I couldn't find how to set defaults so that a form opened in New Record mode, or to control that setting from the same form. I'd be happy to be proved wrong on this one, but I think the only approach you have is to open the form from a Command Button on ANOTHER form:
Code:
Private Sub Command1_Click()
  DoCmd.OpenForm "Invoices", acNormal
  DoCmd.GoToRecord , , acNewRec
End Sub
Sorry -- don't know why they made this bit so hard.

Denis
 
Upvote 0
I'm not sure if this is going to help or not but you can change the "Data Entry" property of the form to "Yes" which will make the form default to a new record every time you open the form. However, the limitation is that you can't use the form to edit or delete existing records - you can only use the form to add new records.

Andrew :)
 
Upvote 0
Nice, Andrew.

That's useful, I've always used the method SydneyGeek decribed.
 
Upvote 0

Forum statistics

Threads
1,216,725
Messages
6,132,342
Members
449,719
Latest member
excel4mac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top