Hiding / Displaying Text / Combo etc boxes

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

Guest

Help please
I have a form tha has quite a few Text/Combo Boxes on it and I use the same
form for different uses. This means I have to clear the form and re-populste
it with the right List / Combo Boxes for that particular use (done via
Openargs from a Menu Form). Currently, I clear the form by listing all the
boxes in the fofmat Listbox1.visible = False through to Listbox59.visible =
False. Then I have to run through the whole thing again to populate it with
the particular boxes that I need for that current operation.
Is there an easier approach?

Thanks RayC
 
If you've got 59 listboxes from Listbox1 to Listbox59, you can simplify
somewhat using:

Dim intLoop As Integer

For intLoop = 1 To 59
Me.Controls("Listbox" & intLoop).Visible = False
Next intLoop

You might find my June, 2004 "Access Answers" column in Pinnacle
Publication's "Smart Access" of interest. You can download the column (and
sample database) for free at
http://www.accessmvp.com/DJSteele/SmartAccess.html (Check out the October,
2004 column as well while you're there)
 
Different forms for each purpose.
What you have is a huge Swiss Army knife - Clumsy to use and wont fit in
your pocket.
 
LOL
my point, exactly.
You could hurt yourself trying to clean your fingernails with that.
 
Thanks for this Douglas but it is not realy what I was looking for. I only
used the term Listbox 1 to 59 in my original post as a way of exlaining the
issue. The Listboxes all have individual names in order to help me when
reffering to them in the program. I could rename them all as Listbox 1 to 59
but that would make ny life so much more difficult when writing the program.

I take Klatu's comments on board and will look at designing multiple Forms,
all the same, but with the odd lLstboxes being different. I guess I was
hoping that there would be some kind of "Wildcard" where I could say
"whatever is visible on the form, make it Invisible".

Thank you both for your valuable input. Where would we beginnes be without
your help and support?
Regards Ray C
 
Did you read the article I mentioned? It talks about how to group controls
when you want them to be treated consistently.
 
Hi -

You don't say how many different uses you have, but have you tried the
Tab control?

You could use one tab (page) for each use, and only put the appropriate
list boxes on each page. That way you no need to worry about
visible/invisible code. It also makes modifying the form a lot easier.

John
 
Back
Top