DoCmd.OpenForm

  • Thread starter Thread starter L.A. Lawyer
  • Start date Start date
L

L.A. Lawyer

I want to use this command to open a blank (ie, new record) form. The
default opens with all records. How do I make it open a new record?
 
I want to use this command to open a blank (ie, new record) form. The
default opens with all records. How do I make it open a new record?
Use acFormAdd in the datamode argument.

DoCmd.OpenForm "frmMyForm",,,,acFormAdd

- Jim
 
You can either set the DataEntry Property of the Form to Yes/True or you can
use the DataMode argument of the OpenForm Method like:

DoCmd.OpenForm "YourFormName", , , , acFormAdd
 
And what's the problem when acFormAdd does not actually open the new record?
I have had to do a
DoCmd.RunCommand acCmdRecordsGoToNew when I open a form to do this. It
doesn't happen on every form, though....

Steve
 
Your Form may be based on a Query that is NOT updateable, i.e. you cannot
add new Records. In this case your Form cannot make the New Record the
Current Record on the Form.

Open the Query in DatasheetView by itself, i.e. not through the Form, and
see if the New Record row is available on the datasheet or the New Record
button in the Navigation bar in enabled.
 
Back
Top