Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria

Status
Not open for further replies.

illini

Technical User
Aug 2, 2002
89
FR
I'm trying to create a query with criteria off of a form. I have the following expression in the Field section of the query:

IIf([forms]![frm_data_export]![CB_Date_Type]=&quot;Eff Date&quot;,[Date_Effective]>=&quot;#&quot; & [forms]![frm_data_export]![TB_Date5] & &quot;#&quot; And [Date_Effective]<=&quot;#&quot; & [forms]![frm_data_export]![TB_Date6] & &quot;#&quot;,[Date_Effective] Is Null Or [Date_Effective] Is Not Null)

This is designed to pull all records between the dates of [TB_Date5] and [TB_Date6]. However, if [CB_Date_Type]<>&quot;Eff Date&quot;, then records for all dates are to be pulled.

When I run the query, I get an error message stating &quot;This expression is typed incorrectly, or it is too complex to be evaluated.&quot;

Any ideas where I've gone wrong? What should I put in the criteria field for this column?
-illini
 
I feel it is always best to put your query in a string and show it as MsgBox SQLstr

This will show you what you are doing wrong. Then when you have debugged it, enter it where you wish. Query's and their debug will make you go blind and your eyes fall out.

rollie@bwsys.net
 
I have a similar question, but being a novice, I need a more concrete answer.

I have a DAO database, with a ClickEvent module which draws
on a query to send emails. I have a form which is used to fill the table which the query is based on.

EmailID
Subject
Message


The user fills a form, and clicks send. The problem is, the Email ID. The email uses the fields referenced in the query. How could you change the query field from the form so the proper email (emailID) will be sent?

Robert
 
The question above as I have posted it, seems quite ambiguous. I have therefore reposted the above question trying to be more clear and to give a concrete example of what I am trying to ask. Please see my posted question in:

How do you reference the current record in a Form?
thread 705-353061

Please forgive the clutter of this post. AND Many thanks to all for the assistance!

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top