Error Message

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?
 
M

Mike Labosh

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top