Using wildcards in a SQL statment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mokeyone
    New Member
    • Feb 2007
    • 2

    #1

    Using wildcards in a SQL statment

    I am trying use an IIf command to limit the query if a checkbox is checked and not limit the query if not checked. Can someone show me what I need to put in the false part of the IIf statement to get all records? I am using Access 2003.

    Code:
    WHERE (((StudentTable.Startdate)<[Forms]![AuditReportForm]![txbTo])
      AND ((StudentTable.EndDate)>[Forms]![AuditReportForm]![txbFrom])
      AND ((StudentTable.PaymentType)=IIf([Forms]![AuditReportForm]![ckbWFonly]=True,"W/F", "%")))
    Last edited by NeoPa; Feb 26 '07, 10:37 PM. Reason: Tags for Layout
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I suppose this should work: "Like '*'"

    Comment

    • mokeyone
      New Member
      • Feb 2007
      • 2

      #3
      Thanks it did help.

      I needed to change the = before the IIf to Like, then the IIf supplied the patterns

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Not a problem. Good luck.

        Comment

        Working...