Opening form to blank record

  • Thread starter Thread starter Joan
  • Start date Start date
J

Joan

How does one code on the click event of a button to open a form at a blank
record so that the user can immediately begin entering a new record?

Joan
 
Joan,

In the OnClick event of the button create a macro
which does these two actions:

On the first line of the macro iterate the OpenForm
action and specify the form name that is going to be
opened.

On the second line of the same macro iterate the
GoToRecord action and specify New.

Save that macro and make sure it is assigned to the
button On Click event.


Another way to do it is to create a macro for the
OnOpen property of the form that is going to be opened.
In that macro you would iterate the action GoToRecord and
specify New.

Those are two ways to do it.

I hope I helped.

Casey
 
That's a little long winded!

Modify the command line in the click event that opens
your data entry form as follows:

Docmd.Openform FormName:="my form name",
DataMode:=acFormAdd

This opens the form in data entry mode only. Users can
enter new records, but cannot view existing records.
They will be able to view/edit any records entered since
the form was opened, but only until the form is closed.

There is no need to create a special data entry form for
this. Your existing form will do the trick - the secret
is in how it is opened.
 
Thanks, Keith.

This helps alot. I almost always use VBA and rarely use the macros.
Would you mind answering another question for me?
How do I open a form where I can view all the records but want the cursor to
go to a particular record in acFormDS view ? Or go to a particular record in
regular form view but can still use the navigation buttons to view other
records?

Thanks again,
Joan
 
Back
Top