SetFocus Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would one write the setfocus code for a control on a second level subform

I have Form "Account Information" with a subform "Location" and Location has a subform "Service Calls".

If I want to setfocus to "Scheduled Service Month" on "Service Calls", How would I structure this

Thank you to everyone who assists us with issues. It is greatly appreciated.
 
Forms![Account Information]!Location.Form![Service
Calls]!somecontrol.SetFocus
or
Me![Location].Form![Service Calls]!somecontrol.SetFocus

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


bdehning said:
How would one write the setfocus code for a control on a second level subform?

I have Form "Account Information" with a subform "Location" and Location has a subform "Service Calls".

If I want to setfocus to "Scheduled Service Month" on "Service Calls", How would I structure this?

Thank you to everyone who assists us with issues. It is greatly
appreciated.
 
Both gave me errors like Location field does not exist when location is subform or a compile erro

----- Graham R Seach wrote: ----

Forms![Account Information]!Location.Form![Servic
Calls]!somecontrol.SetFocu
o
Me![Location].Form![Service Calls]!somecontrol.SetFocu

Regards
Graham R Seac
Microsoft Access MV
Sydney, Australi

Microsoft Access 2003 VBA Programmer's Referenc
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.htm


bdehning said:
How would one write the setfocus code for a control on a second leve subform
appreciated
 
Graham

Thanks for the help. I was able to tweak your code and make it work.

Forms![Account Information].SetFocu
Forms![Account Information]![Location].SetFocu
Forms![Account Information]![Location]![Service Calls].SetFocu
Forms![Account Information]![Location]![Service Calls].Form![Scheduled Service Month].SetFocu


----- Graham R Seach wrote: ----

Forms![Account Information]!Location.Form![Servic
Calls]!somecontrol.SetFocu
o
Me![Location].Form![Service Calls]!somecontrol.SetFocu

Regards
Graham R Seac
Microsoft Access MV
Sydney, Australi

Microsoft Access 2003 VBA Programmer's Referenc
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.htm


bdehning said:
How would one write the setfocus code for a control on a second leve subform
appreciated
 
Back
Top