dbTalk Databases Forums  

Query Criteria Access 2k

comp.database.ms-access comp.database.ms-access


Discuss Query Criteria Access 2k in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Enterprise
 
Posts: n/a

Default Query Criteria Access 2k - 06-24-2004 , 09:55 AM






I'm stuck. I use Access 2000. I have a date field in a query.
What I need done is if a Limit_Date function returns a true, I want
the date field to be Between 1/1/02 and 1/1/03, otherwise I want it
left alone(all records shown).

I have an if statement in the criteria:
iif(Limit_Date()=true,Between 1/1/02 and 1/1/03,"*")
This does not work since the if statement returns strings. So if
Limit_Date is true, then the criteria is "Between 1/1/02 and 1/1/03".
If its false then I get a *, which won't work with out a Like
statement.

Is there a way I can make a Between statement that accepts all dates?
I tried doing Between * and * but it does not work. I was hoping to
put if statements in the *, so if Limit_Date is true, the if would
return a date else "*".

Please help.

Thanks in advance.



Reply With Quote
  #2  
Old   
Downstreamer
 
Posts: n/a

Default Re: Query Criteria Access 2k - 07-04-2004 , 06:42 PM






Enterprise wrote:
Quote:
I'm stuck. I use Access 2000. I have a date field in a query.
What I need done is if a Limit_Date function returns a true, I want
the date field to be Between 1/1/02 and 1/1/03, otherwise I want it
left alone(all records shown).

I have an if statement in the criteria:
iif(Limit_Date()=true,Between 1/1/02 and 1/1/03,"*")
This does not work since the if statement returns strings. So if
Limit_Date is true, then the criteria is "Between 1/1/02 and 1/1/03".
If its false then I get a *, which won't work with out a Like
statement.

Is there a way I can make a Between statement that accepts all dates?
I tried doing Between * and * but it does not work. I was hoping to
put if statements in the *, so if Limit_Date is true, the if would
return a date else "*".

Please help.

Thanks in advance.


Instead of the * why don't you use something like <#1/1/2040# then you
wouldn't have to worry about it again until the year 2040. Have you
tried using null in your iif statement, iif(Limit_Date()=true,Between
1/1/02 and 1/1/03,null).


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.