Goto new record on subform (1 Viewer)

le888

Registered User.
Local time
Yesterday, 22:12
Joined
Dec 10, 2003
Messages
344
Hi,

I have a main form and a subform which is unbound. I have also, a command button on the main form which when Click on it, it should goto an empty record on the subform. I have try

DoCmd.GoToRecord , , acNewRec

This didn't do the job. How do I do this? Any ideas?

Thanks,

Le
 

Ukraine82

Registered User.
Local time
Yesterday, 18:12
Joined
Jun 14, 2004
Messages
346
Try pasting this code

Me.Your Subform Name.SetFocus
DoCmd.GoToRecord , , acNewRec

Michael
 

dt01pqt

Certified
Local time
Today, 02:12
Joined
Mar 22, 2004
Messages
271
Ukraine82 said:
Try pasting this code

Me.Your Subform Name.SetFocus
DoCmd.GoToRecord , , acNewRec

Michael
No do it this way:
Code:
DoCmd.GoToRecord acDataForm, [COLOR=Red][I]"Sub Form Name"[/I][/COLOR], acNewRec

Edit: When I say sub form name I'm talking about the name of the form not the subform object.
 
Last edited:

le888

Registered User.
Local time
Yesterday, 22:12
Joined
Dec 10, 2003
Messages
344
Thanks, unfortunaly I got a message said that my subform is not open. So, how can I deal with this?

Le
 

dt01pqt

Certified
Local time
Today, 02:12
Joined
Mar 22, 2004
Messages
271
le888 said:
Thanks, unfortunaly I got a message said that my subform is not open. So, how can I deal with this?

Le
Ignore what I said and do what Ukraine82 said:eek: Not paying attention sorry. :eek: :eek:
 

Muhammadhama

New member
Local time
Today, 04:12
Joined
Nov 23, 2020
Messages
1
Me.ctlYour Subform Name.SetFocus
DoCmd.GoToRecord , , acNewRec

For office 2010 you must add ctl before your subform name
 

missinglinq

AWF VIP
Local time
Yesterday, 21:12
Joined
Jun 20, 2003
Messages
6,423
I have a main form and a subform which is unbound...
Sorry...but your scenario doesn't make sense! An Unbound Form (i.e. a subform which is unbound) doesn't have any Records (it's Unbound) and so can't have a New Record!

An Unbound Form only contains Unbound Controls, for entering data. This data doesn't become a Record until it is committed a Table...and that Record will never be displayed in an Unbound Form.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom