Subform to Subform Syntax

  • Thread starter Thread starter PJFry
  • Start date Start date
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
 
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 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
 
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
 
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
 
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
 
Back
Top