Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Form with New record

Status
Not open for further replies.

Dominate007

Technical User
Jun 24, 2005
4
ZA
Im compiling a database for my company. My boss wanted the database to open with a "Welcome form" which ive done, on that form there are buttons that link to the other forms in the database. when i click on the button it goes to the form but open on the first record, i want it to open on a new record. i went to the microsoft website and found this
Sub ShowNewRecord()
DoCmd.OpenForm "Employees", acNormal
DoCmd.GoToRecord , , acNewRec
End Sub

That didnt help at all because ive never used visual basic before, but it is now part of my job description!!!! could someone PLEASE help me so that when i click on the button it opens the form with a new record.
The two forms that need to be linked are "Axiom Repair Form" and "Third Party Repair Form"

Thanks a million
 
The simplest way to do this without using VBA is to create a macro to open your form at a new record. Use Datamode 'Add' to get to a new record.
Then use the button wizard to add a button to your menu form that runs the macro.

 
That sounds like it could help, but i cant seem to see where to add a new macro, only where to run an already configured macro.
 
to do it without macro
just put the line
Code:
DoCmd.GoToRecord , , acNewRec
in the OnLoad event of the form as VBA code..

Code:
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub



greets,
Marko 9A6NCM

 
Thanks guys, i placed the code into the appropreate line and it works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top