[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

And Operator in TruePart section of an IIf statement

Posted on 2010-09-13
3
Medium Priority
?
496 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 1000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

649 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