Solved

2 conditions for query based on user input on form

Posted on 2013-11-02
3
467 Views
Last Modified: 2013-11-02
I have a report based on the following querry:

SELECT tMain.FrameLine, tMain.FrameModel, Count(tMain.FrameModel) AS CountOfFrameModel, tMain.FrameOWF, tMain.Office
FROM tMain
GROUP BY tMain.FrameLine, tMain.FrameModel, tMain.FrameOWF, tMain.Office, tMain.Status
HAVING (((tMain.FrameLine)=[Forms]![FReportSelect]![cFrameLine]) AND ((tMain.FrameOWF)=False) AND ((tMain.Office)=[Forms]![FReportSelect]![LocSelect]) AND ((tMain.Status)<>"Cancelled"))
ORDER BY tMain.FrameModel;


I would like to update the query based on [Forms]![FReportSelect]![LocSelect].  as it can either have an acutal office selection OR "All" (for all locations).

Presently it is working for a selected location but I can't find a way to have it work for "All offices.
0
Comment
Question by:thandel
[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
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 39619111
Try this:


SELECT FrameLine, FrameModel, Count(FrameModel) AS CountOfFrameModel, 
    FrameOWF, Office
FROM tMain
WHERE FrameLine) = [Forms]![FReportSelect]![cFrameLine] AND
    FrameOWF = False AND
    Status <> "Cancelled" AND
    (Office = [Forms]![FReportSelect]![LocSelect] OR [Forms]![FReportSelect]![LocSelect] = "All")
GROUP BY FrameLine, FrameModel, FrameOWF, Office, Status
ORDER BY FrameModel;

Open in new window

0
 

Author Comment

by:thandel
ID: 39619129
Error due to an extra )
0
 

Author Comment

by:thandel
ID: 39619130
Found it and that work.  Thanks
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

695 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