Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setfocus on a subform 1

Status
Not open for further replies.

Umbane

IS-IT--Management
Jul 20, 2000
44
ZA
I have a form with a subform, and the subform has a subform also. On the main form, in the form header section I have an unbound combo box from which the user must select a client. On the after update event of the combo box I want the focus to go to a record on the second subform so that data can be input directly.
All the references to how this should be done I have followed, but the focus remains on the combo box.
Here is a sample of my code.

[Deliveries].Form![Jobs]![ProductID].SetFocus

Thanks in advance

Umbane

 
Hi there
Try:
Forms!Mainform!Subform1.Form!Subform2.Form!ControlName

Check out:
Missy Ed
Looking to exchange ideas and tips on VB and MS Access development as well as office 97 development. Drop me a line: msedbbw@hotmail.com
 
Hi Missy Ed

Thanks for the help but it still does not move the focus to the desired field. Maybe I should try redesigning my form so that it doesn't need all the subforms.

Umbane
 
I have had trouble with this in the past as well. Try this:

If you want to go to a particular field:

DoCmd.GoToControl "SubFormName"
DoCmd.GoToControl "FieldName"

If you want to go to a new record:

DoCmd.GoToControl "SubFormName"
DoCmd.GoToRecord , , acNewRec

This has worked for me in the past, and the only help I could find on the subject, said to do it this way.
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top