new record when form loads Ms Access Gurus

Does this help you?

Go to New Record when Access Form Loads

When you want a form to open to a new record use VBA in the form LOAD event.

use VBA to go to a new record when an Access form loads

If you're opening the form using VBA, you could alternatively do this (thanks, Geoff Griffith)

		DoCmd.OpenForm "MyFormName",acNormal,,,acFormAdd 

Quick Jump

Goto Top  

VBA

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 Sub 
Code was generated with colors using the free Color Code add-in for Access

Goto Top  

Reference

Help: Form.Recordset property (Access)

Help: Form.NewRecord property (Access)

Goto Top  

Backstory

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.

Share with others

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

Get Tutoring with Access

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.com

~ crystal

the simplest way is best, but usually the hardest to see

Goto Top