|
When you want a form to open to a new record use VBA in the form LOAD event.
If you're opening the form using VBA, you could alternatively do this (thanks, Geoff Griffith)
DoCmd.OpenForm "MyFormName",acNormal,,,acFormAdd
The form LOAD event happens when records are loaded for a form. This goes in the code behind the form. You can also use DoCmd, but I prefer this method.
Private Sub Form_Load() 'goto a new record when the form loads With Me If Not .NewRecord Then .Recordset.AddNew End If End With End SubCode was generated with colors using the free Color Code add-in for Access
Sometimes you want a form to load with all the records but default to a new record to make it quick for the user to add one. In case they want to find a different record, other records are available.
Here's the link for this page in case you want to copy it and share it with someone:
https://msaccessgurus.com/VBA/Form_NewRecordLoad.htm
or in old browsers:
http://www.msaccessgurus.com/VBA/Form_NewRecordLoad.htm
Let's connect and team-develop your application together. I teach you how to do it yourself. My goal is to empower you.
While we build something great together, I'll pull in code and features from my vast libraries as needed, cutting out lots of development time. And you'll get links to great resources.
Do you want to step up your application?
Let's connect, I can help you make it better.
Email me at training@msAccessGurus
~ crystal
the simplest way is best, but usually the hardest to see