Results 1 to 3 of 3
  1. #1
    Bushbrow is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Location
    Friday Harbor
    Posts
    2

    Question 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

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Do it in VBA:

    Dim strSQL as String

    If isnull(me.Th) Then
    strSQL = "SELECT * FROM myTable"
    Else
    strSQL = [SQL with criteria]
    End If

  3. #3
    Bushbrow is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Location
    Friday Harbor
    Posts
    2
    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.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums