Hi,
I'm running Access 2010 and have a form with an option group that people can click to filter a query (which displays in a list box) with "Accepted", "Declined" or "Show All".
It works great if I choose the Accepted option (value of 1) or the Declined option (value of 4), but I'm having trouble making the Show All option work (value of 99) - it doesn't display any results. Can you help me? The criteria that I'm using for the field in my query is:
IIf([Forms]![Main_form]![Filter_grp]<99,[Forms]![Main_form]![Filter_grp])
Thanks!
Please use code tags when posting code.
You should be doing something like this: - SELECT *
-
FROM someTable
-
WHERE someField = IIf(someParameter <> allValue, someParameter, someField)
Return the field value in the false parameter. That way it will always be true, barring any null values. If you have nulls, you will need to Nz() your field.
4 4704
Where's the false parameter of the iif function? That by itself shouldn't work, it should error out.
Well, I don't have one. :) I'd also tried this: - IIf([Forms]![Main_form]![Filter_grp]<>99,[Forms]![Main_form]![Filter_grp],(1 Or 2 Or 3 Or 4 Or 5))
But that doesn't work, either. It works great if I only have 1 value for the false part (eg, 1), but I'm not able to put in multiple values with the "or" operator. Is there a better way to do this?
This is the SQL, if that helps: - SELECT DISTINCT Sessions.ID, Sessions.CFPTitle, Sessions.Organization, Sessions.CFPac, Sessions.CFPfocus, Review.Status, Events.AC
-
FROM (Sessions INNER JOIN Events ON Sessions.Event = Events.AC) LEFT JOIN (Review LEFT JOIN Status ON Review.Status = Status.StatusID) ON Sessions.ID = Review.Session_ID
-
WHERE (((Review.Status)=IIf([Forms]![Main_form]![Filter_grp]<>99,[Forms]![Main_form]![Filter_grp],((Review.Status)=1 Or (Review.Status)=2 Or (Review.Status)=3 Or (Review.Status)=4 Or (Review.Status)=5))) AND ((Review.User)=GetUserName()))
-
ORDER BY Sessions.Organization;
Please use code tags when posting code.
You should be doing something like this: - SELECT *
-
FROM someTable
-
WHERE someField = IIf(someParameter <> allValue, someParameter, someField)
Return the field value in the false parameter. That way it will always be true, barring any null values. If you have nulls, you will need to Nz() your field.
That works perfectly! Thank you SO much!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: What-a-Tool |
last post by:
I have a school project (ASP) in which I have to call three different ASP
pages from three different and identical (except for the form "action",
obviously) HTM pages. This I have no problem with....
|
by: Gazchurchend |
last post by:
I get straight to the point...
I need to select an item in an option group when a form loads.
Its a PHP form which will have a value sent in when the form loads.
This value is assigned to a...
|
by: Shyguy |
last post by:
I have an option group with about 30 options. I would like to have
the Option Labels get their text from a table. Is this possible, and
if so how?
Also, is it possible to embad a font into a...
|
by: Steve |
last post by:
Access 97.
I have a form where there is an option group with two buttons, and a
combo box. The combo box Row Source is a query. The option group has
two options a) include a subset of the...
|
by: andy.mcvicker |
last post by:
Hi Gang
I used the Option Group wizard to create a group of radio buttons on a
form. It created it with three options and it looks fine. However
when I run the form the first option is checked...
|
by: JHite |
last post by:
I am using Access 2003 on Windows XP.
This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
|
by: sara |
last post by:
Hi
I'm having a very strange problem and need HELP!!
I have a form for the user to choose a report (radio button in an
option group) and parameters (Dates, Season).
Click the option button,...
|
by: tuxalot |
last post by:
I've copied the option group from my form, and pasted it into the report which seems to work fine. Now, I wish to total the option items in the report. So I have a query that grabs records within a...
|
by: hbaf208 |
last post by:
I have an option group (TimeFrameOption) with three options: All, Last 6 months, and Last 12 Months. When an option is selected, I want to query dates in a listbox (CallReport) to display all dates...
|
by: tuxalot |
last post by:
Another quick question for ya...
Here's my button code, and I want to see if I can do something different so I don't have to repeat the same code for each of my 14 buttons in my option group:
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
| |