Open to Blank

N

Nadihaha

I'm hoping this is an easy one and a setting I have just missed seeing.

How do I get my form to open at the *new record* rather than the 1st Record?

I would like for my form to open so that I can enter information straight
away rather than having the first record open (which is going to mean someone
accidentally changes it) I tried the data entry button but the data doesn't
enter the table related to the form.

Thanks
 
J

John W. Vinson

But is there a way to get it to open on data entry view by default?

Two ways.

One is to open the Form in design view and view its Properties. Set the Data
Entry property of the form to Yes, and save the form.

This does have a disadvantage: Data Entry view will let you enter new records
but you will NOT be able to see or edit or search for existing records. If you
want the ability to do so, I'd use a form with Data Entry set to No, and put a
bit of code in the form's Load event. View the form's properties; select the
Events tab; click the ... icon and choose "Code Builder". Access will give you
a Sub and End Sub line, just edit it to

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRecord
End Sub


Note the two commas, they're for default optional parameters.
 
N

Nadihaha

Ok I do want to be able to view and edit records so I wen't with the second
option.
I copied what you put in but now I get the Error - Runtime Error '2105': You
can't go to specified record.

What do I do now? :(
 
J

John W. Vinson

Ok I do want to be able to view and edit records so I wen't with the second
option.
I copied what you put in but now I get the Error - Runtime Error '2105': You
can't go to specified record.

What do I do now? :(

Post your actual code. Is the form updateable (can you use the navigation
buttons to go to the new record, or edit a record that's displayed)?
 
N

Nadihaha

Ok here's my code (really sorry I'm being a pain - I'm a novice) Yes the form
is updateable. I can do it manually but want to make it so someone doesn't
just start typing and overwrite another record.

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRecord
End Sub
 
J

John W. Vinson

Ok here's my code (really sorry I'm being a pain - I'm a novice) Yes the form
is updateable. I can do it manually but want to make it so someone doesn't
just start typing and overwrite another record.

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRecord
End Sub

Odd! Is the form's Allow Additions property set to No? It should be Yes.

Try putting the code in the form's Open event instead of Load.
 

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