Dissapearing list box act

L

LtFass

I have form and on this form is a cmd button and a list box. the list box's
visible property is set to false the cmd button changes the visible proerty
to true. This works great. I want when the user selects an item on the list
box to open a form and change the list box back to invisible. Opening the
form is a snap however I can't fiquire out how to make the list box invisible
when the form opens.

Thanks for all the help

Cliff
 
J

Jeff Boyce

Cliff

Do you want the listbox to be invisible EVERY time the form opens? If so,
set the .Visible property to False.

By the way, users can be disconcerted by having things pop into and out of
existance on the screen. Consider using the .Enabled property instead.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
L

LtFass

Thanks for the help.. The answer to your question is yes the list box needs
to dissappear after the form opens as the list box will not be used again
untill another selection is needed. So right now I have the visible property
set to false and am using the click event of a command button to set the list
box visible property to true. and then when the user selects a value in the
list box the associated form opens. it is this point I want to set the
visible property of the list box back to false. however simple code such as
"me.lstElec = false" isnt working I get the error "cant disable a control
that has focus" which now leads to the issue of setting the focus to the
newly opened form, a feat I havent fiqured out yet Helpppppppp.....
 
J

Jeff Boyce

The solution is in the error message.

It's telling you that it (the listbox) can't turn itself off
(.Visible=False) when it is the control that has the focus.

One approach might be to first set the focus to a different control, then
turn the listbox off.

And I still think that enabling/disabling would be more user-friendly than
making it appear/disappear...

JOPO (just one person's opinion)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Top