Error Message

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

Guest

I have a combo box on my main form that is used to hide/unhide certain
controls on my subform. For example when I choose "1" from the combo box it
hides "field1" and only makes "field2" visible. When I make a choice from
this combo box I get an error message that says

Run-Time error '2165':
You can't hide a control that has the focus

When I click on the debug it highlights a line in my "IF" statement.

Me![frmToleranceChart]![E1].Visible = False

How does this field have the control?
 
I have a combo box on my main form that is used to hide/unhide certain
controls on my subform. For example when I choose "1" from the combo box
it
hides "field1" and only makes "field2" visible. When I make a choice from
this combo box I get an error message that says
Run-Time error '2165':
You can't hide a control that has the focus

MS Access will not let you make something invisible if it has the focus.

Your solution is to make something else get the focus before you try to make
this thing invisible.

Wherever it is that you're trying to make something invisible, insert a line
before it that calls the GetFocus method of some other appropriate control.
--


Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com

"Escriba coda ergo sum." -- vbSensei
 
Back
Top