Visible If - many conditions

Minkey

Registered User.
Local time
Today, 21:41
Joined
Jul 7, 2004
Messages
659
I'm trying to produce a form with 4 text boxes that dependant on combo box are visible or not. I understand I can do it using

if.combo = "A" then me.text1.visible = true else false etc..

My problem is I have 5 choices from the combo box, A,B,C,D,E and 4 text boxes , left, centre, right and rear and I cant figure out how to do this:

If A, centre visible
If B, left, right visible
If C, left, right, centre visible
If D, left, right and rear visible
If E, left, right, centre and rear visible

In fact is this the best way to do it ??

I'm very new to VB any help would be appreciated.
(I'll be off line soon for a few hours so I may not be able to reply straight away)

Oh by the way I have thought of using a seperate form for each selection A,B etc but Id like to know if it's possible via code
 
Last edited:
i suppose your best option is Select/Case. You're just looking for a way to make the code (better/cleaner/eleganter?) than many if..then..elses, right?

MS Select syntax page


Oh by the way I have thought of using a seperate form for each selection A,B etc but Id like to know if it's possible via code
you could make 5 different forms (same size). put a subform in your main form. set the OnChange event for your combo box to change the source object property of the child subform.

Or you could learn how to change the controls on a form dynamically, en masse! if you do share the knowledge, :)
 
Minkey,

Enjoy ...

Wayne
 

Attachments

Thanks Wayne - perfect !
Mod - thanks for the link will be very handy
 
Ok, I kinda want to do the same thing, but I want it to update after I click a command button and while printing. I almost have it working, but I have no experience with programming.

Any suggestions??

How do I post code here?
 
Wayne did a GREAT job on that. I think I would make only one modification, though. I would create an On Open event for the form that sets all the fields to Visible = False. That way, you won't see any of the fields until you complete the combo.
 

Users who are viewing this thread

Back
Top Bottom