What's the simplest way to make sure my form always opens up to a new (i.e. blank) record? Currently it opens to the first record in the database.
Thanks,
What's the simplest way to make sure my form always opens up to a new (i.e. blank) record? Currently it opens to the first record in the database.
Thanks,
If you set the Form's Data Entry Property to Yes, it will open to a New Record, but only allow the addition of New Records; existing Records cannot be viewed/edited.
To view existing Records but always open to a New Record:
Code:Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec End Sub
Linq ;0)>
Thanks Missinglinq, that worked perfectly!
Glad we could help!
Linq ;0)>
Missinglinq,
all of a sudden I started getting an error of Return without GoSub. Any ideas why ?
thanks,
You need to start a new thread for this, with an appropriate title, but one common cause is copying and pasting code into the code window, and accidentally pasting one procedure within another, something like
so I'd start by looking at the code behind the errant Form. When it errors out are you offered the option to debug, and if so, and you click to debug, where does it take you?Code:Private Sub TextboxOne_AfterUpdate() 'code here for TextboxOne Private Sub YourCombobox_AfterUpdate() 'code here for YourCombobox End Sub End Sub
Linq ;0)>
and it also seems to be breaking when I save as ACCDE. any thoughts on that one?
Linq, Any idea why it would just not work when i save as ACCDE?
Also,check out the Docmd.Openform command.
From code (a button click event) you would use :
The Form's Data Entry Property should be No. The form would always open in add mode (a new record).Code:DoCmd.OpenForm "frmYourFormName", , , , acFormAdd