Solved

And Operator in TruePart section of an IIf statement

Posted on 2010-09-13
3
489 Views
Last Modified: 2012-05-10
Dear Experts,

I'm currently trying to figure out how to produce a query in MS Access that says "if today is Monday then look for data within a 24hr period, 4 days in the future"

The query that I've been working on appears to work when sperated down but not as a whole.  After much searching I found this might be because it is not possible to use the 'AND' operator in the TruePart of an IIf statement.

Does anybody know of a way round this?  I'm no expert in MS Access so the simpler the better!

Current Query:

iif(WeekDay(date())=2,>Format(Date()+4,"yyyymmdd") & "0000" And <Format(Date()+4,"yyyymmdd") & "2400","")

Thanks in anticipation,

Neil
0
Comment
Question by:qvhit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:Runrigger
ID: 33660575
can you include the full query please
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 33660611
you need 2 conditions, not 1, for example
> iif(WeekDay(date())=2, Format(Date()+4,"yyyymmdd") & "0000" )
< iif(WeekDay(date())=2, Format(Date()+4,"yyyymmdd") & "2400" )

Open in new window

0
 

Author Comment

by:qvhit
ID: 33660677
Thank you angelIII, sometimes it's just that simple!

I changed

iif(WeekDay(date())=2,>Format(Date()+4,"yyyymmdd") & "0000" And <Format(Date()+4,"yyyymmdd") & "2400","")

to become

>IIf(Weekday(Date())=2,Format(Date()+4,"yyyymmdd") & "0000") And <IIf(Weekday(Date())=2,Format(Date()+4,"yyyymmdd") & "2400")

and now it works!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question