Solved

Multi Where clause

Posted on 2013-12-31
3
246 Views
Last Modified: 2013-12-31
Hi,
I am trying to open a report based on a where clause depending on what the user selects in an optionframe on a form.

I have looked through here and google but I am getting more and more confused.
It works if I select an option with a single number behind it, but not with the two numbers. (the numbers are primary keys for the customers).

Any help is appreciated.
Thanks
Dim strWhere As String
Dim Cust As Integer

Select Case Me.frameProdGroup
    Case 1
        Cust = 300 Or 169
    Case 2
        Cust = 444 Or 329
    Case 3
        Cust = 238
    Case 4
        Cust = 220
    Case 5
        Cust = 235
    Case 6
        Cust = 180
End Select

strWhere = "[fkCustID] = " & Cust
DoCmd.OpenReport "rptStoxBase", acViewReport, , strWhere

Open in new window

0
Comment
Question by:Stephen Byrom
[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 48

Accepted Solution

by:
Dale Fye earned 500 total points
ID: 39748615
Try this:

Dim Cust As as string

Select Case Me.frameProdGroup
    Case 1
        Cust = "IN (300,169)"
    Case 2
        Cust = "IN (444,329)"
    Case 3
        Cust = " = 238"
    Case 4
        Cust = " = 220"
    Case 5
        Cust = " = 235"
    Case 6
        Cust = " = 180"
End Select

strWhere = "[fkCustID]  " & Cust
DoCmd.OpenReport "rptStoxBase", acViewReport, , strWhere
0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
ID: 39748648
Perfect!
Thanks for your time, you've saved me loads
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39748656
glad I could help.

Happy New Year!
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

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…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

632 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