Add new record to subform

J

JustinP

How is this done? I can't seem to get it too work...

I'm using:

Me!Forms!MasterOwner!DoCmd.GoToRecord , , acNewRec
 
B

Barry Gilbert

Try:
Me!Forms!MasterOwner!Form!SomeControlInTheForm.SetFocus()
DoCmd.GoToRecord , , acNewRec

on two seperate lines.

Barry
 
J

JustinP

I get the error message:
....can't find the field "Forms" refered to your expression.

I used:
Me!Forms!frmCORRESPONDENCE!Form!txtITEM.SetFocus
DoCmd.GoToRecord , , acNewRec

Thanks
 
J

John Vinson

I get the error message:
...can't find the field "Forms" refered to your expression.

I used:
Me!Forms!frmCORRESPONDENCE!Form!txtITEM.SetFocus
DoCmd.GoToRecord , , acNewRec

Thanks

Belt and suspenders!

Me!

and

Forms!frmCORRESPONDANCE

both mean the same thing (assuming that this is frmCORRESPONDANCE
you're working on).

Use one or the other - not both.

John W. Vinson[MVP]
 
J

JustinP

You're right, thanks.

It now says "Can't go to the specified record"

I'm using:

Forms![frmCORRESPONDENCE].Form![subfrmCorrespondence].Form![txtITEM].SetFocus
DoCmd.GoToRecord , , acNewRec

Any ideas?
 
J

JustinP

Worked it out. Needed to set AllowAdditions for both main form and
subform. Thanks for your help.

You're right, thanks.

It now says "Can't go to the specified record"

I'm using:

Forms![frmCORRESPONDENCE].Form![subfrmCorrespondence].Form![txtITEM].SetFocus
DoCmd.GoToRecord , , acNewRec

Any ideas?


John said:
Belt and suspenders!

Me!

and

Forms!frmCORRESPONDANCE

both mean the same thing (assuming that this is frmCORRESPONDANCE
you're working on).

Use one or the other - not both.

John W. Vinson[MVP]
 
J

John Vinson

Worked it out. Needed to set AllowAdditions for both main form and
subform. Thanks for your help.

Yep... if you want to add a new record, you do! It's not instantly
obvious that BOTH forms need it to be true, but IIRC they do.

John W. Vinson[MVP]
 
Top