View Full Version : Macro to open a new record


keletso
09-14-2004, 03:48 AM
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

BarryMK
09-15-2004, 04:17 AM
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

ColinEssex
09-16-2004, 01:04 AM
As an alternative to Barry's excellent reply, you could change the Data Entry property of the form to 'Yes'

Col

strobinson1
10-21-2004, 12:52 AM
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 ??????

mcadle
10-21-2004, 09:38 AM
Use the same form. Just add a command button to go to a new rec on click.