Multiple criteria...

  • Thread starter Thread starter Cerberus
  • Start date Start date
C

Cerberus

I'm relatively new to programming so forgive me if I have trouble conveying
my question properly. Is it possible to show a new UserForm based on meeting
three criteria? In my case, I have multiple door sizes that are available
but only when a certain criterion have been met, i.e. "25belt-full swing-flip
up" has multiple opening sizes but a "48belt-full swing-flip up" only has one
size.

Now I want to make a UserForm "pop up" when the conditions are right, that
have the opening sizes so I don't have too many grayed out selections when
choices are not applicable. So in the example above I would think I need
something like (and this is where I have the lack of knowledge):

If Start.Option25belt.Value = True And _
Door.OptionFullSwing.Value = True And _
Door.OptionFlipUp.Value = True Then
Opening.Show
End If

I'm sure that is not even close to being correct but I hope it helps give a
understanding of what I'm looking for. Thank you in advance for any
assistance.
 
your code looks fine so long as you have a userform called Opening

why don't you populate a LISTBOX with the available sizes?
 
Thank you for your response

I not sure a LISTBOX would work well with all the variables I have. See, I
have 6 different belt sizes, 6 different door options and 26 different door
openings. While the 25Belt option has up to 11 door opening options and
31Belt has 8, the 48Belt option only has 1. I don't want to give the
impression that you could have multiple options to the belts that are limited
to one opening size.

Now of course you have much more experience than I do about all of this, so
if you know of a trick to make a LISTBOX work properly I would be more than
happy to listen to your idea.
 
If Start.Option25belt.Value = True And _
Door.OptionFullSwing.Value = True And _
Door.OptionFlipUp.Value = True Then
     Opening.Show
End If

That will work fine.
If you want to cover all possible combinations then it might get a bit
complicated. You can create a userform on the fly, in code, to suit
your requirements. That does get a bit tricky if you want arbitrary
numbers of controls on the form though, as arrays of controls are not
supported and you need to write wrapper classes to emulate the
function. Probably more work than you want.

I tend to use a structure a bit like this, using a binary encoding
scheme and noting that "True" = -1

Select Case -1 * Start.Option25belt _
- 2 * Door.OptionFullSwing.Value _
- 4 * Door.Option.Flipup.Value
Case 0
Userform1.Show
Case 1
Userform2.Show
Case 2, 4
Userform3.Show
Case 3, 5, 7
Userform4.Show
Case 6
Userform5.Show
Case Else
MsgBox "How the heck did that happen?"
End Select
 
so when the user selects a 31Belt, the code will (1) clear the door opening
sizes from the listbox then (2) add the door options for that particular
belt

I can send a file to you directly if you would like to see what i mean...
excel; 2003 or 2007
 
Thank you, 2007 please.

Patrick Molloy said:
so when the user selects a 31Belt, the code will (1) clear the door opening
sizes from the listbox then (2) add the door options for that particular
belt

I can send a file to you directly if you would like to see what i mean...
excel; 2003 or 2007
 
Back
Top