473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Parameter query using criteria and IIf function

1
I need to create a query using inputs from my form, it's check button. What I wish to do is when the check button is ticked it will show me open records or show me all records. Open records are those for which closure date is null.
Expand|Select|Wrap|Line Numbers
  1. Expr1: IIf([forms]![Main]![OpenOnly]=True,IIf(IsNull([QA Closure Date]),1,0),1)
This code is working well but I am not understanding the '1' in the end, also I have to put a 1 in the criteria section of the design view. Is there a thing that Access assigns 1 to all the records by default or is it because of my code?
Feb 19 '19 #1
1 1109
twinnyfo
3,653 Expert Mod 2GB
Sanchi,

Welcome to Bytes!

It appears that your criteria expression is more useful for counting records, but it also works to select records, too—I have used such designs in the past also. By having the expression resolve to either a 1 or a 0, having the 1 in the Criteria line allows you to select only those records which resolve to 1 which, in this case is those records in which OpenOnly is checked and Closure date is Null OR OpenOnly is Unchecked.

However, an easier expression might be:

Expand|Select|Wrap|Line Numbers
  1. (([forms]![Main]![OpenOnly] And IsNull([QA Closure Date]) Or Not [forms]![Main]![OpenOnly])
With True in the Criteria section.

I’m not sure if any of this answers your question, but I’m not sure of the exact question.

Hope this hepps!
Feb 19 '19 #2

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

Similar topics

1
by: Jim | last post by:
MS-Access 2002 I have a query (Q2) based on a parameter query (Q1) and need to set the parameters within a VBA module. I am using ADO, and opening the query (Q2) as a fordwardonly recordset. ...
2
by: Scott Cannon | last post by:
I am trying to query 3 tables all related by Clinet_ID. The Clients table, Monthly_Expenses table and Monthly_Income table. Each client can have 0>M instances of expenses, past due expenses, and...
3
by: mukeshhtrivedi | last post by:
Hi Gurus, I have created simple query as SELECT QUOTES.DATE, QUOTES.QUOTENO, QUOTES.SALESREP, QuoteItem.ITEM, QUOTES., QUOTES.CUSTOMER, QUOTES.AMOUNT, QUOTES., QUOTES.DivisionID,...
0
by: =?Utf-8?B?VG9ueSBBLg==?= | last post by:
I'm trying to develop a parameter query using Query Builder, the database is Access 2003. I placed a ? in the column to we quered and linked it to a checkbox on the form. When the user selects an...
11
by: mezmerize | last post by:
Firstly a description of the situation to give you an insight. have a table of motorcycles (Registration no.,makes,models,colour,no.owners, etc. and i would like to be able to run a query that...
3
habby0123
by: habby0123 | last post by:
I am trying to export data to Excel from a query in Access. There is a unique "Sales Region ID" and various "Territory#'s" for each Region. I would like one excel workbook for each region, and a...
2
by: celticmystyrose | last post by:
I am a beginner in access I was making a database for work. I need to make a query to bring out information from two separate data fields. My table is as such Surname; First name; Date1; time 1;...
0
by: Gerry Goldberg | last post by:
I am trying to learn to user Parameter queries. My simple test query is: PARAMETER CHAR ; SELECT * FROM tblAccount WHERE = "123456" In my VBA code, I have determined that I want to run this...
2
by: tomric | last post by:
I have a question on passing data to the criteria of a parameter of a parameter query using VBA. I have a query set up that has ten different fields in it. One is field named “status”, this field...
1
by: DCGordon1991 | last post by:
I am able to run a simple query using criteria for a particular field in one table. Other tables also have this field present. When I try to run a query in these other tables using criteria for this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.