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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help setting focus on a subform 1

Status
Not open for further replies.

spruceni

Technical User
May 18, 2007
72
GB
Hi
I have studied the results of my search for setting focus on a sub form and followed the suggestions. In the code below after opening the form "frmTechAssesSub" containing the subform "frmJobSheetNo9EditSub" and closing the calling form I want to set the focus on the "firstname" in the sub form. This is ignored and the focus remains on the first field in the main form.

However using the same instructions I can use msgbox to display correctly the contents of "FirstName" in the instruction following.

What am I doing wrong?


' Open Clients filtered on the current row
DoCmd.OpenForm FormName:="frmTechAssesSub", WhereCondition:=strFilter
' Close me
DoCmd.Close acForm, Me.Name

Forms!frmTechAssesSub!frmJobSheetNo9EditSub.Form.FirstName.SetFocus

MsgBox " first name " & Forms!frmTechAssesSub!frmJobSheetNo9EditSub.Form.FirstName

Exit Sub
 
Try it in two stages.


Forms!frmTechAssesSub!frmJobSheetNo9EditSub.SetFocus
Forms!frmTechAssesSub!frmJobSheetNo9EditSub.Form.FirstName.SetFocus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top