open form on "new record" screen (1 Viewer)

Funkyaccess

Registered User.
Local time
Today, 09:12
Joined
Oct 8, 2009
Messages
69
Hi,

I have a form with tabs and each tab contains a subform. How can I set this subform to start with a new record?
 

boblarson

Smeghead
Local time
Today, 09:12
Joined
Jan 12, 2001
Messages
32,059
You can also use this:

Code:
Me.YourSubformControlNameHere.Form.Recordset.AddNew

Where YourSubformControlName is the name of the subform control on the main form which houses the subform.

See here for which name you use:

 

Funkyaccess

Registered User.
Local time
Today, 09:12
Joined
Oct 8, 2009
Messages
69
thanks for both the options. wheres the best place to initialise the docmd/.addnew to goto the new record?
 

boblarson

Smeghead
Local time
Today, 09:12
Joined
Jan 12, 2001
Messages
32,059
thanks for both the options. wheres the best place to initialise the docmd/.addnew to goto the new record?

On Load event of the subform.

So if you do that, then you will not want to use my code, but instead just use JBB's, or use

Code:
If Not Me.NewRecord Then
   DoCmd.RunCommand acCmdRecordsGoToNew
End If
 

Funkyaccess

Registered User.
Local time
Today, 09:12
Joined
Oct 8, 2009
Messages
69
Thanks both of you. I'm now getting the effect I was after.
 

Users who are viewing this thread

Top Bottom