Quick Query Problem

PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
SELECT InspectionsDI.ID,InspectionsDI.Area
FROM InspectionsDI
WHERE InspectionsDI.Area=Forms![Main Form]!cmbArea;

This code works correctly for each individual area but I also want to allow 
all the records to show if Forms![Main Form]!cmbArea = "ALL"

I am not sure how to do this, I tried If statement but my syntax must have 
been wrong, thanks for help.
0
Utf
2/3/2010 10:51:01 PM
access.queries 6343 articles. 1 followers. Follow

3 Replies
994 Views

Similar Articles

[PageSpeed] 46

Try this --
PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
SELECT InspectionsDI.ID,InspectionsDI.Area
FROM InspectionsDI
WHERE InspectionsDI.Area Like IIF(Forms![Main Form]!cmbArea = "All", "*", 
Forms![Main Form]!cmbArea);

-- 
Build a little, test a little.


"dannie" wrote:

> PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
> SELECT InspectionsDI.ID,InspectionsDI.Area
> FROM InspectionsDI
> WHERE InspectionsDI.Area=Forms![Main Form]!cmbArea;
> 
> This code works correctly for each individual area but I also want to allow 
> all the records to show if Forms![Main Form]!cmbArea = "ALL"
> 
> I am not sure how to do this, I tried If statement but my syntax must have 
> been wrong, thanks for help.
0
Utf
2/3/2010 11:18:01 PM
PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
SELECT InspectionsDI.ID,InspectionsDI.Area
FROM InspectionsDI
WHERE InspectionsDI.Area=Forms![Main Form]!cmbArea OR 
Forms![Main Form]!cmbArea="ALL";

-- 
Duane Hookom
Microsoft Access MVP


"dannie" wrote:

> PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
> SELECT InspectionsDI.ID,InspectionsDI.Area
> FROM InspectionsDI
> WHERE InspectionsDI.Area=Forms![Main Form]!cmbArea;
> 
> This code works correctly for each individual area but I also want to allow 
> all the records to show if Forms![Main Form]!cmbArea = "ALL"
> 
> I am not sure how to do this, I tried If statement but my syntax must have 
> been wrong, thanks for help.
0
Utf
2/3/2010 11:28:02 PM
On Wed, 3 Feb 2010 14:51:01 -0800, dannie <dannie@discussions.microsoft.com>
wrote:

>This code works correctly for each individual area but I also want to allow 
>all the records to show if Forms![Main Form]!cmbArea = "ALL"
>
>I am not sure how to do this, I tried If statement but my syntax must have 
>been wrong, thanks for help.

PARAMETERS [Forms]![Main Form]![cmbArea] Text ( 255 );
SELECT InspectionsDI.ID,InspectionsDI.Area
FROM InspectionsDI
WHERE InspectionsDI.Area=Forms![Main Form]!cmbArea
OR Forms![Main Form]!cmbArea = "All";

-- 

             John W. Vinson [MVP]
0
John
2/3/2010 11:52:48 PM
Reply:

Similar Artilces:

Build Dynamic Query from Form
I am trying to build a dynamic Query from a Form. I keep getting an error that reads ‘Object qryFilter already exists’ I suspect it has something to do with the string of dates being passed to the Query; strDateCondition = "([Trades].[TDATE] Between [Forms]![SearchForm]![cboFrom] And [Forms]![SearchForm]![cboTo])" I am trying to add a means for a user to Query by Customer and Trader AND all records between two dates. This was working fine for Customer and Trader; when I added in the code to filter by dates I started having problems. I know the SQL will be li...

Problem with systemstate backup with DPM 2010
Hi! We running DPM 2010RC on a Windows 2008 R2 The Protected computer is: Microsoft(R) Windows(R) Server 2003, Standard Edition 5.2.3790 Service Pack 2 Build 3790 When we installed the DPM agent the first backup of system state was successfully, so we have one restore point. But further backups in failing, the system state backup is in status “replica is inconsistent” and when I running a consistent check the job failing. In the error in DPM is: The replica of System Protection Computer\System Protection on sea0700smon1.xxxx.local is inconsistent with the protected data so...

Fewer normal template problems with Word 2000 or 2002?
I have enjoyed some things about Word 2007, but I keep having problems with macros and templates. I am wondering if (a) macros increase the likelihood of corrupting the normal template in 2007, or (b) if the older versions of Word had as many template problems. I have used Word in 2000, with Office 2003, and now with Office 2007 and I don't ever recall having as many problems as I've had with 2007. What I'm thinking is that if it is simply a macro problem causing corruption, I would simply use 2007 without the macros (they're nice but I can live without them). On the...

Questiontest-outlookwebservices problem
hi all and thanks for the support. i'm facing a problem with test.outlookwebservices. notice that oulook side everything seems to be pretty good: the autodiscovery and auto-configuration of the account succeedes, the test email autoconfiguration suceedes too. when i launch the test, once it suceedes for certain services and after a while it fails for those services and suceedes for other. look the prints: here are failing the RPC tests Message : [EXCH] The UM is configured for this user in the AutoDiscover response received from https://mytest-EXC1. myt...

Quick Journal and Checkbook
I am trying to set up an easy way to post ACH transactions. Currently we have been using Bank Tranactions and using Increase/Decrease adjustment. I thought I could use Quick Journal, but it does not post to the Checkbook Register. The transactions are similar each month. It is for sending out Child Support payments and 401(K) contributions. Any ideas on how this can be done efficiently? Thanks PS I'm fairly new to Great Plains, so I may be missing something obvious. We are on Version 7.0 Can Quick Journal be set up to post to a checking account? loneieagle wrote: > I am trying to ...

Font problem
It seems that the Cambria Math font has recently acquired an extremely large Ascent and Descent. Has it perhaps always been that way and I've never noticed it before, or is it something recent, perhaps a Vista thing? Try the following code for example. For Arial and Times New Roman (and virtually all other fonts) I am getting pretty much exactly what I would expect (a TextHeight that is a bit larger than the point size) but for Cambria Math I am getting an extremely large TextHeight (I get exactly the same results using GDI32 methods). At this end (on my Vista Business laptop...

08 Mac Office activation problems
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Just found an article posted by michellec and I am faced with exactly the same problem - on 'activation' of the product, none of the 3 product keys seem to be correct, hence activation is unsuccessful!! Have received some help emails (and thanks Diana yours had the microsoft help number that has been good, despite the fact they can't help me and tell me I must get in touch with Digital River) but seems that what I need is another product key, and now that I'm asking for that since about 10 days, I don't get any reply ...

please help with this query
Ost Ocity Dstate Dcity Carrier Price Rank Diff A B C D X 1200 1 100 A B C D Y 1300 2 100 A B C D Z 1350 3 100 A B C D W 1789 4 100 A1 B1 C1 D1 X1 785 1 A1 B1 C1 D1 Y1 789 2 The rank for every carrier is based on the price . If rank1 carrier is not a pariticular carrier(say if it is not X1 or Y1 or Z1), then i want to calculate the difference be...

Autoshapes' visible problem
When I add some Rectangle autoshapes above the embeded chart, I find it's hard to control it's visibility, They maybe hide when I select some cell or activate chart. I want to know how to make them always visible no matter what I select. Thank you in advance! ^_^ Yours,fujing You need to click on the chart before you use the drawing tool. In this way the Shape and the Chart become one. best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "fujing1003" <fujing1003@gmail.com> wrote in message news:1171358292.074278.135950@v33g2000cwv...

Update Query
Access 2003 XP SP2 I am having a problem with an update query. Table is in a one-to-one relationship, referentail integrity and cascading data are checked. (The fileds I want to update are not in both tables) Table name= payForward Has 15 fields ie: ID, Name, MemID, Oct , Nov, Dec, etc Oct-Sep fields are yes/no type I want to "select" a field (Oct-Sep) via a query parameter and repalce "yes" with "no". Here is my query: UPDATE payForward SET [Enter month]=No The messages I get is 'operation must use an updateable query' Wh...

Office 2004 SP 11.1.0 installation problems
I'm trying to update Office 2004 on my brand new iBook. I installed Office 2004 from the CD without incident. Then I downloaded SP 11.1.1.0 and 11.1.0 (which according to the MS website is to be installed 1st.) When I try to install, I received a message, "An error prevented the update from completing 11002:2,-14" The "Read Me" file indicates several potential explainatins/solutions none of whice are relevant except for uninstalling Office and then reinstalling it. I tried dragging the Office folder to the trash and reinstalled and am having the same problem. I've t...

RMS and/or PC Charge Problems
We are having some interesting problems with our RMS system and PC Charge: For no apparent reason RMS will have an error message after a card is swiped or keyed into the system: • DENIED (With a wide variety of error messages) • DUPLICATE use F+ to force (even when it is the first transaction) • TIMED OUT Attempted solutions: • Turned modem off and on • Disconnected the modem and plugged everything back in • Turned the server on/off • Called PC Charge only to be told that it is RMS • RMS said it is PC Charge • Confirmed that everything is set up properly in PC Charge and RMS What works:...

Quick Styles
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I am taking a class in Word and am very frustrated with how different the Mac version is from what I am studying. Is there a clipboard other than the basic cut and paste? I mean a clipboard where we can see the text stored. Also, I am looking for "Quick Styles". Using "help" it told me that they are on the formatting palette under "Quick Styles and Effects" I don't have that option on my palette. Does it connect to Word Help for Mac or for the regular version? I'm frustrated and would ...

Outlook 2003 Signature Problem
I've created a signature with my company logo (.jpg file) using Outlook 2003. When the signature is attached in my email, the photo/icon file shows a box with an 'x' in place of the .jpg file. I checked the location where the files are stored and I found the .jpg file in the proper folder under signatures. Thanks in advance for your help. Mike Tools - options -security tab, click on change automatic download settings. Change to what you want. "Mikeul" <Mikeul@hotmail.com> wrote in message news:1132112656.7e1c9b39fdb73a3c7ed44fdbd3e3fbc4@fe5.teranews.com......

Problem in restricting users from sending/receving internet email
I have found a helpful articel here: http://www.msexchange.org/tutorials/MF009.html I read it through couple times but I would like to ask some questions before I start the work on our Exchange 2000 server. 1. The "group" I am going to create for adding users into the restricting list, will it be a Security group or Distribution group? What group scope should I give it? 2. Under the section of "Restricting Users from Sending Internet Base Email", the article tells us to create a *new* SMTP connector and add the group into the "Dilivery Restriction" page. Will ...

how to set up a query
I am using sql server 2005 express and have 3 tables Table1 Dept_Id (primary key) Dept_Name Table2 Employee_Id (primary key) Dept_Id (foreign key with table1) Employee_Name Table3 WorkSchedule_Id (primary key) Employee_Id (foreing key with table 2) Date_To_Work (date type) I want to list all the Departments (Dept_Name) that do not have anyone scheduled to work on a particular date (ie '1/20/2010' ) Any help would be appriciated. Thanks in advance, RABMissouri2010 Try this: SELECT dept_name FROM Table1 AS D WHERE NOT EXISTS(SELECT * ...

Excel comparative query
I'm respectfully requesting assistance with the correct formula to use for the following query: I'd searching all of column A on spreadsheet 1 to see if a value in column A of spreadsheet 2 is there, and placing a result X (or another) next to (adjacent cell) the confirmed value on spreadsheet 2. Please help if you can. Chris Hi Chris see your answer in puclic.excel -- Regards Frank Kabel Frankfurt, Germany Chris wrote: > I'm respectfully requesting assistance with the correct formula > to use for the following query: > > I'd searching all of column A on ...

Outlook Draft Email Print Problem
I have emails saved in draft but when i go to print them it doesnt show who it is being sent to and the fact it hasnt been sent yet, i have played with the setting but to no avail. I am using outlook 2003 any help would be appriciated. Turn off WordMail before printing the draft (Tools | Options | Mail Format) or wait to print until after you send it. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx <kpmail76@yahoo.co.uk> wrote in message news:...

Outlook 2002 HTML printing problem
Outlook 2002. I cannot print HTML emails. Plain text prints without any problems just HTML will not. Office xp pro is at all latest service packs. Anyone have an idea what may be wrong? ...

Currency Format Lost in Union Query
Thanks to John Spencer, I resolved one problem in my union query (Thank you, John). But I have another problem. Some of my fields in my union query are currencies and others percents. I see both formats are lost. I am sure it is a union query problem, because when I ran an individual query, none of the formats were lost. Is there any way I can keep currency and percent formats without writing, FORMATCURRENCY, etc for each field? Thank you. What data types are these fields? The field in a UNION query will normally take on the data type of the field in the first SELECT. So, if ...

Syncronizing Outlook Contacts with Quick Books Pro #2
I am unable to get "home" addresses in Outlook Contacts to show up in Quick Books Pro. Only the "business" addresses show up. HELP!!!! which version of outlook and did it ever sync all the addresses? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Search for answers: http://groups.google.com Most recent posts to the Outlook newsgroups: http://groups.google.com/groups?as_ugroup=microsoft.public.outlook.*&num=30 "Curtis&qu...

MS Office 2007 Enterprise Problem
Hi, Gurus, I am using Windows Vista Business version and have installed the above version of MS office. When I close all three application software, i.e., word, excel, and powerpoint, a same message shows up "Microsoft Office Live Add-in Sign-in has stopped working", and then "A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available". Anyone has any idea as to how to correct this? Thanks. Jon Gather all the necessary documentation that you received with the Home Use Program of Office...

Formula Problem #7
Hi there, Can anyone tell me what is wrong with the following formula (it's doing my nut in!): IF([DAY]<>"Y",0,IF(OR((OR((AND((OR([START1]<=7,[START1]<8)),([END1]>7))), (AND((OR([START2]<=7,[START2]<8)),([END2]>7))))),(OR((AND((OR([START3]<=7,[START3]<8)),([END3]>7))), (AND((OR([START4]<=7,[START4]<8)),([END4]>7)))))),1,0) I've replace cell refs with [x..]'s. Many thanks - David It seems that there is a parenthesis missing at the end. Best, Guillermo "Daveo" <writetodaveo@gmail.com> wrote in message news:1...

Getting all Sproc through one query
Hi all, can anyone help in getting below information from all stored procedure from one DB we have 100 procedure in one DB of sql server 2005.instead if of manully getting info for each procedure i want all below details in one shot or one query Procedure Name : Input Parameter : Output Parameter : Called By : Calls : Dependent tables : Thanks in advance ...

Lions Club Project Help Needed
I hope I have the right group for this question. I am Radio Auction Chairman in the Rayne Lions Club in Louisiana and I am working with Excel to enter all the items for our Live Radio Auction. I have entered all auction items in Excel and now I want to copy & paste the information into a word document. When I copy & insert the column, it also paste the cells. I need just the information for the newspapers. Can I just copy & paste just into information into a word file without the cells? Also, if I have listed the items from top to bottom in a column, is there any way to flip...