-
IIF truepart >0
I am trying to use multiple IIf statements as a criteria in a select query. The fields are numerical. The IIf statement works except when I set a truepart or falsepart ">0" (the quotes are for the purpose of this question).
Exp: IIf(IsNull([Forms]![Form1]![Th]),>0,[Forms]![Form1]![Th])
The issue starts with a form with multiple Combo boxes that contain the dimensions of lumber Thickness, Width, Length, etc. My goal is to select all the items in inventory for a parameter when nothing is selected for that parameter.
Example: If 2 and 4 are selected for thickness and width, but nothing for length, all lengths of 2x4 in inventory are displayed. >0 works by itself as a criteria, but not in the IIf statement and an integer works in the IIf statement. It evaluates correctly except when I use >0 as a truepart or falsepart. Perplexed
-
Do it in VBA:
Dim strSQL as String
If isnull(me.Th) Then
strSQL = "SELECT * FROM myTable"
Else
strSQL = [SQL with criteria]
End If
-
Sorry to take so long for the reply. Thanks for the help, my problem is I know nothing about VBA. This experience has convinced me to learn it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules