Subform to Subform Syntax


P

PJFry

I am trying to tab from the last control on sfMother to the first control on
sfFather.

Both sf's appear on fFamily.

Here what I am doing:
Private Sub sngAge_Exit(Cancel As Integer)
'sngAge is the last control on sfMother

Forms![fFamily]![sfFather].Form![txtName].SetFocus

End Sub

It does not produce an error, it just goes back to the first control on
sfMother. My cycle is set to current record.

If I code it to go to Forms![fFamily]![RecordID] it works just fine, so I am
guessing it doesn't know where to go.

Thoughts?
PJ
 
Ad

Advertisements

S

strive4peace

First, you have to set focus to the subform control on the mainform,
then you can set it to a specific control in that subform

me.parent.subform_controlname.Setfocus
me.parent.subform_controlname.form.txtName.Setfocus

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*
 
P

PJFry

I think I get it, but I need a some clarification.

I am on the subform sfMother when I want to run this code. To do this I
will need to set focus to the subform control sfFather on fFamily (parent).
Yes?

And would the use of pages affect this? I just realized that that each of
these subforms sit on a page on the main form. I image that will require
some special handling, Access being what it is.

Thanks again!
PJ

strive4peace said:
First, you have to set focus to the subform control on the mainform,
then you can set it to a specific control in that subform

me.parent.subform_controlname.Setfocus
me.parent.subform_controlname.form.txtName.Setfocus

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


I am trying to tab from the last control on sfMother to the first control on
sfFather.

Both sf's appear on fFamily.

Here what I am doing:
Private Sub sngAge_Exit(Cancel As Integer)
'sngAge is the last control on sfMother

Forms![fFamily]![sfFather].Form![txtName].SetFocus

End Sub

It does not produce an error, it just goes back to the first control on
sfMother. My cycle is set to current record.

If I code it to go to Forms![fFamily]![RecordID] it works just fine, so I am
guessing it doesn't know where to go.

Thoughts?
PJ
 
S

strive4peace

Pages have no effect on referencing controls

try:
me.parent.sfFather.Setfocus
me.parent.sfFather.form.txtName.Setfocus

sfFather is substituted for subform_controlname in what I previously
posted ... I am assuming that sfFather is the NAME property of the
subform control containing that form

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


I think I get it, but I need a some clarification.

I am on the subform sfMother when I want to run this code. To do this I
will need to set focus to the subform control sfFather on fFamily (parent).
Yes?

And would the use of pages affect this? I just realized that that each of
these subforms sit on a page on the main form. I image that will require
some special handling, Access being what it is.

Thanks again!
PJ

strive4peace said:
First, you have to set focus to the subform control on the mainform,
then you can set it to a specific control in that subform

me.parent.subform_controlname.Setfocus
me.parent.subform_controlname.form.txtName.Setfocus

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


I am trying to tab from the last control on sfMother to the first control on
sfFather.

Both sf's appear on fFamily.

Here what I am doing:
Private Sub sngAge_Exit(Cancel As Integer)
'sngAge is the last control on sfMother

Forms![fFamily]![sfFather].Form![txtName].SetFocus

End Sub

It does not produce an error, it just goes back to the first control on
sfMother. My cycle is set to current record.

If I code it to go to Forms![fFamily]![RecordID] it works just fine, so I am
guessing it doesn't know where to go.

Thoughts?
PJ
 
P

PJFry

Perfect.

I am so used to substitutions in code that I forgot that me.parent is really
me.parent, not me.NameOfParentForm.

Thanks!

strive4peace said:
Pages have no effect on referencing controls

try:
me.parent.sfFather.Setfocus
me.parent.sfFather.form.txtName.Setfocus

sfFather is substituted for subform_controlname in what I previously
posted ... I am assuming that sfFather is the NAME property of the
subform control containing that form

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


I think I get it, but I need a some clarification.

I am on the subform sfMother when I want to run this code. To do this I
will need to set focus to the subform control sfFather on fFamily (parent).
Yes?

And would the use of pages affect this? I just realized that that each of
these subforms sit on a page on the main form. I image that will require
some special handling, Access being what it is.

Thanks again!
PJ

strive4peace said:
First, you have to set focus to the subform control on the mainform,
then you can set it to a specific control in that subform

me.parent.subform_controlname.Setfocus
me.parent.subform_controlname.form.txtName.Setfocus

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*



PJFry wrote:
I am trying to tab from the last control on sfMother to the first control on
sfFather.

Both sf's appear on fFamily.

Here what I am doing:
Private Sub sngAge_Exit(Cancel As Integer)
'sngAge is the last control on sfMother

Forms![fFamily]![sfFather].Form![txtName].SetFocus

End Sub

It does not produce an error, it just goes back to the first control on
sfMother. My cycle is set to current record.

If I code it to go to Forms![fFamily]![RecordID] it works just fine, so I am
guessing it doesn't know where to go.

Thoughts?
PJ
 
Ad

Advertisements

S

strive4peace

you're welcome, PJ ;) happy to help

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


Perfect.

I am so used to substitutions in code that I forgot that me.parent is really
me.parent, not me.NameOfParentForm.

Thanks!

strive4peace said:
Pages have no effect on referencing controls

try:
me.parent.sfFather.Setfocus
me.parent.sfFather.form.txtName.Setfocus

sfFather is substituted for subform_controlname in what I previously
posted ... I am assuming that sfFather is the NAME property of the
subform control containing that form

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*


I think I get it, but I need a some clarification.

I am on the subform sfMother when I want to run this code. To do this I
will need to set focus to the subform control sfFather on fFamily (parent).
Yes?

And would the use of pages affect this? I just realized that that each of
these subforms sit on a page on the main form. I image that will require
some special handling, Access being what it is.

Thanks again!
PJ

:

First, you have to set focus to the subform control on the mainform,
then you can set it to a specific control in that subform

me.parent.subform_controlname.Setfocus
me.parent.subform_controlname.form.txtName.Setfocus

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*



PJFry wrote:
I am trying to tab from the last control on sfMother to the first control on
sfFather.

Both sf's appear on fFamily.

Here what I am doing:
Private Sub sngAge_Exit(Cancel As Integer)
'sngAge is the last control on sfMother

Forms![fFamily]![sfFather].Form![txtName].SetFocus

End Sub

It does not produce an error, it just goes back to the first control on
sfMother. My cycle is set to current record.

If I code it to go to Forms![fFamily]![RecordID] it works just fine, so I am
guessing it doesn't know where to go.

Thoughts?
PJ
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top