473,480 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IIF(OR possible in Access?

5 New Member
PLEASE HELP!!

I am trying to build an expression in an Access report that looks at a Main Query (record source of all learners) and asks it specific questions. I am basically trying to write an IIf statement similar to below with an OR clause. I know it is wrong because the OR clause messes it up when I build the expression, but what I am trying to ask Access is

[code]=Sum(IIf([TR_Start]<#01/08/2011# And [TR_End] Is Null OR [TR_End] >#31/07/2011# And [progtype] Like "99" And [agecode] like "1",1,0))[\CODE]


Expand|Select|Wrap|Line Numbers
  1. [TR_Start]
is learners' start date
Expand|Select|Wrap|Line Numbers
  1. [TR_End]
is the learners' end date
Expand|Select|Wrap|Line Numbers
  1. [agecode]
is for singling out age ranges in categories from 1-4. 1 is 16-18 yr olds
Expand|Select|Wrap|Line Numbers
  1. [progtype]
is type of programme they are studying. 99 is NVQ Training

I basically want to take a snapshot view of specific learners at the 1st day of each month. So I want learners with agecode of 1 who are on a progtype of 99 who also have a null end date OR a greater end date than the last day of the preceding month AND a training start date less than the first day of the month in question. I can achieve this
Expand|Select|Wrap|Line Numbers
  1. is Null or <
in the criteria of a query but not in an expression in a text box on a report.

Can anyone please offer any straightforward solution?

Any help greatly appreciated. :-)
Oct 11 '11 #1
3 1654
NeoPa
32,556 Recognized Expert Moderator MVP
Parentheses "()" should do the trick for you :
Expand|Select|Wrap|Line Numbers
  1. =Sum(IIf([TR_Start]<#01/08/2011# And ([TR_End] Is Null Or [TR_End] >#31/07/2011#) And [progtype]='99' And [agecode]='1',1,0))
Alternatively, in this particular situation, you could use the Nz() function instead :
Expand|Select|Wrap|Line Numbers
  1. =Sum(IIf([TR_Start]<#01/08/2011# And Nz([TR_End],#31/12/9999#)>#31/07/2011#) And [progtype]='99' And [agecode]='1',1,0))
Oct 11 '11 #2
Madmonty
5 New Member
Thank NeoPa! That worked a treat!! You're a star!!
Oct 11 '11 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Always pleased to help :-)
Oct 11 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6023
by: Riyad | last post by:
Hi all, I have trouble instantiating a COM object from an ASP file: Server.CreateObject raises "Access Denied" error. The COM object is a VB.Net assembly registered for COM Interop. It can be...
7
2299
by: jason | last post by:
Is there a way - possibly a disconnected rs? - to update the contents of an existing pulldown on a page without having to re-submit the page for the user to see the pulldown populated with an...
3
1389
by: Neil Greenough | last post by:
I am looking into some possible ideas to get rid of a lot of paperwork for a volunteer organisation I work for, and just want to know if this is possible to do with MS Access? Basically, at the...
1
1246
by: David A Barajas | last post by:
Is is possible to launch an Access Application within another app, creating a Parent/Child relationship between the App/Access? I'm trying to create a system where I can distribute the Access app...
8
3118
by: carriolan | last post by:
Hi I have an MS Access based application almost ready for distribution to the public and I find that even though I have compiled it into an MDE file, tables and queries can still be be imported if...
3
1209
by: iwdu15 | last post by:
hi, this might b getting a bit too...low level but how can i check to see if a certain memory address holds a charge? -- -iwdu15
24
1693
by: Lauren Wilson | last post by:
OK, I'm confused. SOME folks here seem to be saying it IS possible to link to or otherwise access and manipulate MDB files stored on a web server (from the client) and others seem to be saying...
0
1055
by: mohsin via AccessMonster.com | last post by:
Hi there It's possible access do a diagram box, base on queries from table? or i have to link to other's application? I plan to create one tools which need to link between one table to each...
4
3139
by: Cindy H | last post by:
Hi I am currently using Visual Studio.Net 2003 running on Windows Server 2000 operating system. I have used Visual Studio.net 2003 connecting to Access 2002 databases in the pass with great...
7
1838
by: Lost Prophet | last post by:
Hi I have the below code which is to generate a 2D Array... The problem is that I need to populate it by part of array... not by complete array. For example... map = 1; map = 1; map = 1; ...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7044
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6739
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
181
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.