A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date comparison in IIF statement in a query



 
 
Thread Tools Display Modes
  #1  
Old February 20th, 2010, 04:51 PM posted to microsoft.public.access.queries
LL
external usenet poster
 
Posts: 96
Default Date comparison in IIF statement in a query

I have a form with a control containing a date. This date is used in a query
as part of a IIF statement included in the criteria row of the query:

IIf(IsNull([Forms]![RiderMatchAnalysis]![Start
Date]),[Meeting]![MeetingDate],[Forms]![RiderMatchAnalysis]![Start Date])

The syntax must be wrong in some way as it does not return any records.

Any help would be appreciated.

Thanks.
  #2  
Old February 20th, 2010, 05:34 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Date comparison in IIF statement in a query

LL wrote:

I have a form with a control containing a date. This date is used in a query
as part of a IIF statement included in the criteria row of the query:

IIf(IsNull([Forms]![RiderMatchAnalysis]![Start
Date]),[Meeting]![MeetingDate],[Forms]![RiderMatchAnalysis]![Start Date])

The syntax must be wrong in some way as it does not return any records.



You can not include a partial expression (operator) inside a
function because function just return a value.

Try something more like:

(thefield = Meeting.MeetingDate And
Forms!RiderMatchAnalysis![Start Date] Is Null)
OR thefield Forms!RiderMatchAnalysis![Start Date]

I suggest that you make that change in SQL view before
seeing how Access messes with it in design view.

--
Marsh
MVP [MS Access]
 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.