Macro to open a new record

  • Thread starter Thread starter keletso
  • Start date Start date
K

keletso

Guest
I have a database with an autonumber field and would like to create a macro to open a new form everytime the form is opened. Please help am a newby in this. Thanks
 
If you mean you wish to open a form on a new record place this code in the OnOpen event of your form


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "YourFormName"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
 
As an alternative to Barry's excellent reply, you could change the Data Entry property of the form to 'Yes'

Col
 
I have a form that I want to use to display all my records, but also want to be able to use the same for as a data entry form.

is it possible to have two buttons on my main menu that open the same form...one that opens all the records and the other that opens it only as a data entry form?

Or do I just use two seperate forms that look the same ??????
 
Use the same form. Just add a command button to go to a new rec on click.
 

Users who are viewing this thread

Back
Top Bottom