Tricky IF condition

CharlesHerrick

Registered User.
Local time
Today, 14:24
Joined
Oct 28, 2003
Messages
20
I'm using the following If statement in an Access 2000 procedure:

If state = "KY" And county <> 'Knox' And county <> 'Scott' Then
do something
End If

I want to change this to let a user pick one of more county names from a list, use the selections to build and save a "condition" clause in a variable, then use the variable in the "If" statement, like this:

Dim strCounty As String
strCounty = " And county <> 'Knox' And county <> 'Scott' "
If state = "KY" & county Then
do something
End If

This scenario gives a False result, regardless of the data. I've tried wrapping the entire condition in parentheses, and using Variant instead of String for the variable, with no luck. Am I trying the impossible? If so, is there another method that would accomplish the same thing?

Thanks for any and all help.
 
Try a multi-select list box for the uset to select counties to exclude. Then iterate through the list using the "For Each" or "For Next" statement. This may be a good start.
 
Thanks, Mike. I'll give your suggestion a try. Charles
 

Users who are viewing this thread

Back
Top Bottom