SetFocus Error (1 Viewer)

kawai6rr

Registered User.
Local time
Today, 05:14
Joined
Aug 26, 2009
Messages
21
First off I have 3 tables:
Table 1 has a one to many to table 2 and table 2 has a one to many to table 3.

I have three forms, the main form that houses subform1 to table 2 and subform1 houses subform3 to table 3.
Table 1 (formQuery_MemberInfo)
One to many
Table 2 (hospAdmits) Subform in formQuery_MemberInfo
One to many
Table 3 (subform_conditions) Subform in hospAdmits

I’m setting visibility between hospAdmits and subform_conditions to true or false. When setting visibility to subform_conditions to false I’m getting the error “You can’t hide a control that has focus”. OK makes sense but when I try to set focus to any of the other forms I ‘m unable to do so.

Here’s the code I’m using, I’ve tried a few different ways but keep coming up short.

Private Sub Command25_Click()
'Me.Parent.Form.Combo20.SetFocus
'Me.Combo20.SetFocus
DoCmd.OpenForm "formQuery_MemberInfo"
With Forms!formQuery_MemberInfo
Me.Combo20.SetFocus
End With
Call hideConditions
'Forms![formQuery_MemberInfo]![hospAdmits]![ subform_conditions].Visible = False
End Sub
Private Sub hideConditions()
Forms![formQuery_MemberInfo]![hospAdmits]![subform_conditions].Visible = False
End Sub

Any help is appreciated, thanks!!
 

kawai6rr

Registered User.
Local time
Today, 05:14
Joined
Aug 26, 2009
Messages
21
I actually figured it out, I was obvioulsy calling it incorreclty. Here's what ended up working, probably don't need to set up a separete sub procedure but this works.

Forms![formQuery_MemberInfo]![hospAdmits]![hospAdmitsComments].SetFocus
Call hideConditions
 

Users who are viewing this thread

Top Bottom