Re: Set up Parameter Query to accept more than one entry
From: Duane Hookom (duanehookom_at_NO_SPAMhotmail.com)
Date: 10/13/04
- Next message: Ken Snell [MVP]: "Re: Calculated Mean"
- Previous message: Duane Hookom: "Re: Need help with query to sum top N values in group and rank the results"
- In reply to: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Next in thread: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Reply: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 12 Oct 2004 21:09:32 -0500
I don't know what your region field name is but I think you might have
included two "WHERE"s in your SQL which isn't allowed. Try something like:
SELECT Maint_Stations.NAME, Maint_Stations.STREET, Maint_Stations.PO_BOX,
Maint_Stations.CITY_ZIP, Maint_Stations.ZIP_CODE, Maint_Stations.TYPE
FROM Maint_Stations
WHERE Maint_Stations.TYPE Like "R*" AND InStr("," & [Enter Region Number/s]
& ",","," & [RegionID] & ",")>0
ORDER BY Maint_Stations.DIST;
--
Duane Hookom
MS Access MVP
"Tim" <Tim@discussions.microsoft.com> wrote in message
news:F8884719-21FC-42E7-8184-8C11B068D334@microsoft.com...
> I have changed the query and eliminated the <"s". The SQL view is now:
> SELECT Maint_Stations.NAME, Maint_Stations.STREET, Maint_Stations.PO_BOX,
> Maint_Stations.CITY_ZIP, Maint_Stations.ZIP_CODE, Maint_Stations.TYPE
> FROM Maint_Stations
> WHERE (((Maint_Stations.TYPE) Like "R*"))
> ORDER BY Maint_Stations.DIST;
>
> When I try to enter the string you sent on the criteria line in design
view
> I get an
> error response that says: The expression you entered contains invalid
> syntax. You may have entered an operand without an operator.
>
> If I try to paste the string you recommended directly into SQL View when I
> save it, it gives an error message that says: Syntax error (missing
operator)
> in query expression "where InStr(","&[Enter Region
> Number/s]&",",","&[RegionID]&",")>0(((Maint_Stations.TYPE)Like"R*"))
>
> Neither action (trying to enter the string) will not complete, that is
why
> you don't see anything in the SQL View that resembles what you
recommended.
>
> By the way, I inherited this database from someone else and it was
> originally in Access 97 format and I had to convert it to Access 2003
could
> that be causing a problem? Also I am at the beginning end of the learning
> curve with Access which has probably already been obvious to you. It's
hard
> for this 62 year old dog to learn new tricks but, I'm at least asking
> questions.
>
> Tim
>
> Please advise
>
> "Duane Hookom" wrote:
>
> > I don't see anything like I recommended using Instr(). Also, your where
> > syntax looks messed up. Is TYPE supposed to be <"S"?
> >
> > --
> > Duane Hookom
> > MS Access MVP
> >
> >
> > "Tim" <Tim@discussions.microsoft.com> wrote in message
> > news:EF4AB300-5E93-4758-A448-1C274AB07605@microsoft.com...
> > > Here is the current SQL View:
> > >
> > > SELECT Maint_Stations.NAME, Maint_Stations.STREET,
Maint_Stations.PO_BOX,
> > > Maint_Stations.CITY_ZIP
> > > FROM Maint_Stations
> > > WHERE (((Maint_Stations.TYPE) Like "R*") AND
> > > ((([Maint_Stations].[TYPE])>"RMH")<"S"))
> > > ORDER BY Maint_Stations.DIST;
> > >
> > > Thank You for being patient.
> > >
> > >
> > > "Duane Hookom" wrote:
> > >
> > > > Could you paste your full SQL view? How can we find your syntax
error
> > > > without seeing your sql or your data?
> > > >
> > > > --
> > > > Duane Hookom
> > > > MS Access MVP
> > > >
> > > >
> > > > "Tim" <Tim@discussions.microsoft.com> wrote in message
> > > > news:50F73A58-B5AE-4EC9-A568-11E4B6DD039B@microsoft.com...
> > > > > Thank You for your response Duane. I am still having trouble I
put
> > this
> > > > > in the criteria line in design mode and it just gives me "Syntax
> > Error"
> > > > > apparently
> > > > > I am doing something wrong or it goes somewhere else? I changed
the
> > > > > "[RegionID]" to the name of the field in my database was that
correct?
> > > > >
> > > > > "Duane Hookom" wrote:
> > > > >
> > > > > > You can set up a where clause like:
> > > > > > WHERE InStr("," & [Enter Region Number/s] & ",","," & [RegionID]
&
> > > > ",")>0
> > > > > > Users must enter values with a comma between and no spaces.
> > > > > >
> > > > > > --
> > > > > > Duane Hookom
> > > > > > MS Access MVP
> > > > > >
> > > > > >
> > > > > > "Tim" <Tim@discussions.microsoft.com> wrote in message
> > > > > > news:F114AD7C-7E77-4B37-8B40-FC95B85AF66C@microsoft.com...
> > > > > > > I have a parameter query that requests the user to enter a
region.
> > I
> > > > have
> > > > > > a
> > > > > > > field that contains 12 regions numbered 1 through 12. I often
> > need
> > > > the
> > > > > > same
> > > > > > > data from
> > > > > > > more than one region at a time. How can I set up the
parameter
> > query
> > > > to
> > > > > > > accept
> > > > > > > more than one region? i.e "Enter Region Number/s" then enter
1, 6
> > or
> > > > > > something
> > > > > > > along that nature and have it return the combined data.
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >
- Next message: Ken Snell [MVP]: "Re: Calculated Mean"
- Previous message: Duane Hookom: "Re: Need help with query to sum top N values in group and rank the results"
- In reply to: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Next in thread: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Reply: Tim: "Re: Set up Parameter Query to accept more than one entry"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|