Re: Query from field w/multiple values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: PC Datasheet (nospam_at_nospam.spam)
Date: 01/11/05


Date: Tue, 11 Jan 2005 19:54:54 GMT

Change your Where statement to:
WHERE [Scrap Data].[Plant Code]=[Enter Plant1 number] Or _
    [Scrap Data].[Plant Code]=[Enter Plant2 number] Or _
    [Scrap Data].[Plant Code]=[Enter Plant3 number] Or _
    [Scrap Data].[Plant Code]=[Enter Plant4 number]

Use as many "Or" statements as you have plants.

--
                                        PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
                              resource@pcdatasheet.com
                                 www.pcdatasheet.com
"James Kendall" <JamesKendall@discussions.microsoft.com> wrote in message
news:388B3AB5-24C2-4F2C-B8BD-96497777B976@microsoft.com...
> What I mean is can I enter multiple criteria in the same criteria request?
> For example I have a query that asks for a plant code.  I can enter one
> number, say 41, and it will query just fine.  If I try to enter two plant
> codes, say 41 and 44, it will return nothing.  I want the operator to be
able
> to enter any number of plant codes they need in the same criteria field.
>
> If I wrote it in SQL with hard entered plant codes it would look like
this:
> SELECT [Scrap Data].[Plant Code], Count([Scrap Data].[Plant Code]) AS
> [CountOfPlant Code]
> FROM [Scrap Data]
> WHERE ((([Scrap Data].[Plant Code])=41)) OR ((([Scrap Data].[Plant
Code])=44))
> GROUP BY [Scrap Data].[Plant Code]
>
> If I write it in user entry format it looks like this:
> SELECT [Scrap Data].[Plant Code], Count([Scrap Data].[Plant Code]) AS
> [CountOfPlant Code]
> FROM [Scrap Data]
> WHERE ((([Scrap Data].[Plant Code])=[Enter Plant number(s)]))
> GROUP BY [Scrap Data].[Plant Code];
>
> is there any way to make the criteria [Enter Plant number(s)] be able to
> allow multiple plants so that the query will run it like the first
mentioned
> SQL if I entered plant codes 41 and 44?  Meaning enter multiple criteria
in
> the same criteria request box for the query.
>
> "JL" wrote:
>
> > Hi James,
> >
> > Using the "[Criteria]" should let you change the value everytime when
you
> > execute your query.
> >
> > There is another way that you can query more than one value.
> > You can build a table that will contain all the values that you want to
> > retrieve in a single field.  Then you can JOIN them and get your records
back.
> >
> > Hope this helps.
> >
> >
> > "James Kendall" wrote:
> >
> > > Is there a way to set up a field so that a query will read the
value(s) as
> > > criteria?
> > > I use [plant] but that seems to only allow me to enter one value.  Can
I get
> > > it to be able to enter two or three?  If I can not do it that way is
there a
> > > way to get the query to change a value for the criteria?
> > > --
> > > Thank you for your time.
> > > Windows NT
> > > Office 97


Relevant Pages

  • RE: Query from field w/multiple values
    ... What I mean is can I enter multiple criteria in the same criteria request? ... For example I have a query that asks for a plant code. ... If I wrote it in SQL with hard entered plant codes it would look like this: ...
    (microsoft.public.access.queries)
  • Re: Query from field w/multiple values
    ... Check out the topic "Use Multi-Select List boxes as query parameters" at the ... > two criteria fields in the form or is there a way to enter all the plant ... >>> For example I have a query that asks for a plant code. ... >>> If I wrote it in SQL with hard entered plant codes it would look like ...
    (microsoft.public.access.queries)
  • Re: crosstab query does not recognize form reference
    ... > manufacturing plant. ... Then I created a query that shows ... > in the criteria. ... > recognized it fine in the query that the crosstab query ...
    (microsoft.public.access.queries)
  • Query from field w/multiple values
    ... Is there a way to set up a field so that a query will read the valueas ... I use [plant] but that seems to only allow me to enter one value. ... way to get the query to change a value for the criteria? ... Windows NT ...
    (microsoft.public.access.queries)
  • Re: Aligning beyond "Joining" in query--forcing blank rows to appe
    ... Another table used in every query is Respondent ID, ... Power only reported 30 out of the 104 items on the Plant in Service table, ... I am thinking I'll need to paste Row Literal Table into Excel, ... When I export my data into Excel I want to line up all the Row Literals in ...
    (microsoft.public.access.queries)