Have you tried

  like [Forms]![DLG_Report]![Country] & "*"

Regards, 

Mark Bartnik 



To: [email protected]
From: [EMAIL PROTECTED]
Date: Fri, 18 Jul 2008 22:06:08 +0000
Subject: [Access VBA Central] IIF statements in Query not pulling Wildcards



















    
            I am using Access 2007 and have a user form that contains a text box

that is used as a filter for a Query. The form also contains a button

that is used to open the query. The goal is for the user to be able to

leave the field blank and have the query pull ALL the data, or enter

in filter criteria and have the query filter the data. Here is what I

have written and places in the Criteria Line in the query:



IIf(IsNull([Forms]![DLG_Report]![Country]),Like "*",[Forms]!

[DLG_Report]![Country]),



Note:

[DLG_Report] = Form with text box user enters data

[Country] = Text Box Field



This does not produce any results. If I remove the "*" and type in

"Australia" and run the query with the empty field, data with

"Australia" in the field pulls up. If I remove the IIF statement and

just enter Like "*", all the data pulls up. But, when I include the

IIF statement with the "*" statement, no data is pulled. Any ideas?




      

    
    
        
        
        
        


        


        
        
        
        
        



[Non-text portions of this message have been removed]

Reply via email to