I have tried everything and read everything I can find on this very basic
event. I need to create an event that will move the focus from the parent
form to the sub form and set the focus to a field. This is what I am
currently using.
Dim ctl As Control
Set Ctl = [BillingCompany]![DeliverySubform].Form![ShipDate]
DoCmd.GoToControl ctl.Name
BillingCompany is the parent, DeliverySubform is the subform and shipdate is
the field on the deliverysubform that I want move the focus to.
I can't seem to get my head around this one. Any help will be greatly
appreceiated.
|
|
0
|
|
|
|
Reply
|
Utf
|
1/4/2008 5:42:01 AM |
|
Each form (main and subform) has its own active control.
Therefore you need 2 steps:
1. Make the subform the active control on the main form.
2. Set the active control in the subform.
Assuming this code is running in the main form's module:
Me.Sub1.SetFocus
Me.Sub1.Form!ShipDate.SetFocus
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Randy Christiansen" <RandyChristiansen@discussions.microsoft.com> wrote in
message
news:543B1987-E40D-4552-B8EE-9366E2365D00@microsoft.com...
>I have tried everything and read everything I can find on this very basic
> event. I need to create an event that will move the focus from the parent
> form to the sub form and set the focus to a field. This is what I am
> currently using.
>
> Dim ctl As Control
> Set Ctl = [BillingCompany]![DeliverySubform].Form![ShipDate]
> DoCmd.GoToControl ctl.Name
>
> BillingCompany is the parent, DeliverySubform is the subform and shipdate
> is
> the field on the deliverysubform that I want move the focus to.
>
> I can't seem to get my head around this one. Any help will be greatly
> appreceiated.
|
|
0
|
|
|
|
Reply
|
Allen
|
1/4/2008 5:56:42 AM
|
|
That worked very nicely. Thank you so much for your help.
"Allen Browne" wrote:
> Each form (main and subform) has its own active control.
> Therefore you need 2 steps:
> 1. Make the subform the active control on the main form.
> 2. Set the active control in the subform.
>
> Assuming this code is running in the main form's module:
> Me.Sub1.SetFocus
> Me.Sub1.Form!ShipDate.SetFocus
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Randy Christiansen" <RandyChristiansen@discussions.microsoft.com> wrote in
> message
> news:543B1987-E40D-4552-B8EE-9366E2365D00@microsoft.com...
> >I have tried everything and read everything I can find on this very basic
> > event. I need to create an event that will move the focus from the parent
> > form to the sub form and set the focus to a field. This is what I am
> > currently using.
> >
> > Dim ctl As Control
> > Set Ctl = [BillingCompany]![DeliverySubform].Form![ShipDate]
> > DoCmd.GoToControl ctl.Name
> >
> > BillingCompany is the parent, DeliverySubform is the subform and shipdate
> > is
> > the field on the deliverysubform that I want move the focus to.
> >
> > I can't seem to get my head around this one. Any help will be greatly
> > appreceiated.
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/4/2008 6:09:03 AM
|
|