IF/Then with Multiple Conditions

chadbrewyet

New member
Local time
Today, 09:02
Joined
Aug 19, 2014
Messages
9
Looked around and haven't found a satisfactory answer. I'm trying to create an If/Then statement that needs to match to multiple values. My initial thoughs were to create a list but that doesn't seem to work the way I thought it would.

For example:
If Me.Field = 1,2,5, or 8 Then
Do 'X'
Else IF Me.Field = 3,4,6 or 7 THen
Do 'Y'
Else Do 'Z'


I haven't been able to get the syntax to work right. I'd rather not have to do 'Me.Field = 1 or Me.Field = 2, etc.' but if that's the only way to have it work right, then I guess it'll have to do.

Thanks.
 
My initial thoughs were to create a list but that doesn't seem to work the way I thought it would.
Talking about your initial thoughts, what kind of list did you make and how did it not work the way it should?
 
I tried an array with my values in it but could never get the syntax to process the IF/then properly. I've made several changes to the code since beginning so I can't remember exactly how it was coded before and exactly what error it kept throwing.
 
Alright. I thought you were talking about a table, because that's what you actually need.
 
Looked around and haven't found a satisfactory answer. I'm trying to create an If/Then statement that needs to match to multiple values...
Did you look at the "Select Case" condition?
 
You might be right there J.

If it's an action that needs to be performed following the checks then it's SELECT..CASE.
If it's a value that that should be derived following the checks then a table is required.
 

Users who are viewing this thread

Back
Top Bottom