Problem with hiding control/setfocus (1 Viewer)

davegillian

New member
Local time
Today, 09:28
Joined
Apr 13, 2006
Messages
9
I've got a form, let's call it mainform. On mainform is subform1, on which is subform2, on which is subform3.

Having inputted data on subform3 I want to click on a command button "hide_button" on subform1 which will hide subform3.

I thought initially that clicking on hide_button would also set the focus to the control hide_button but my code

Me.subform2.form!subform3.form.visible=false

...throws up runtime error 2165 "Can't Hide a Control That Has the Focus"

I've tried setting the focus away from the subform to a field on subform1 "field1"...

Me.field1.setfocus
Me.subform2.form!subform3.form.visible=false

but I still get the error.

Any ideas? This one's driving me mad!
 

MStef

Registered User.
Local time
Today, 09:28
Joined
Oct 28, 2004
Messages
2,251
Try this:

[Forms]![MainFormName]![Subform1]![Subform2]![Subform3].Visible = False
 

Users who are viewing this thread

Top Bottom