|
 |
access thread: Query Problems
Message #1 by gail711@g... on Tue, 27 Nov 2001 10:38:58
|
|
Ok, I'm sure i'm missing something obvious but .. this query is supposed
to take the value in a text box on a form, search for values containing it
in a table and display the results in a combo box.
SELECT CostCentres.[Cost centre]
FROM CostCentres
WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 - 2001-
2002].[school]))
GROUP BY CostCentres.[Cost centre];
The problem is i want to use wild cards, if i type in e.g test i want to
get all the results with that word, ie test primary, test academy. I
don't know where to put them. I tried this -
SELECT CostCentres.[Cost centre]
FROM CostCentres
WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 - 2001-
2002].[*school*]))
GROUP BY CostCentres.[Cost centre];
Doesn't give me the right results where you run just the query(although it
does give me more than the first query) and it doesn't work in the form.
Get box asking for parameters.
Is there an easy way of doing this?
Message #2 by "Alan Douglas" <aland@a...> on Tue, 27 Nov 2001 14:30:38
|
|
You have to concatenate the wildcard asterisks to the beginning and end of
your field like this ...
Like '*' & [forms]![period 2 - 2001-2002].[school] & '*'
... AL
Message #3 by "Joseph N. Stackhouse" <joe@s...> on Tue, 27 Nov 2001 09:31:48 -0500
|
|
% is a wildcard in SQL not *, * actually performs multiplication.
-----Original Message-----
From: gail711@g... [mailto:gail711@g...]
Sent: Tuesday, November 27, 2001 10:39 AM
To: Access
Subject: [access] Query Problems
Ok, I'm sure i'm missing something obvious but .. this query is supposed
to take the value in a text box on a form, search for values containing
it
in a table and display the results in a combo box.
SELECT CostCentres.[Cost centre]
FROM CostCentres
WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 -
2001-
2002].[school]))
GROUP BY CostCentres.[Cost centre];
The problem is i want to use wild cards, if i type in e.g test i want to
get all the results with that word, ie test primary, test academy. I
don't know where to put them. I tried this -
SELECT CostCentres.[Cost centre]
FROM CostCentres
WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 -
2001-
2002].[*school*]))
GROUP BY CostCentres.[Cost centre];
Doesn't give me the right results where you run just the query(although
it
does give me more than the first query) and it doesn't work in the form.
Get box asking for parameters.
Is there an easy way of doing this?
---
You are currently subscribed to access as: joe@s... To
unsubscribe send a blank email to $subst('Email.Unsub')
Message #4 by brian.skelton@b... on Tue, 27 Nov 2001 19:53:45
|
|
While % is a wildcard in ANSI SQL, Access SQL accepts '*' and '?'. It is
also used for multiplication...
-Brian
> % is a wildcard in SQL not *, * actually performs multiplication.
>
> -----Original Message-----
> From: gail711@g... [mailto:gail711@g...]
> Sent: Tuesday, November 27, 2001 10:39 AM
> To: Access
> Subject: [access] Query Problems
>
>
> Ok, I'm sure i'm missing something obvious but .. this query is supposed
>
> to take the value in a text box on a form, search for values containing
> it
> in a table and display the results in a combo box.
>
> SELECT CostCentres.[Cost centre]
> FROM CostCentres
> WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 -
> 2001-
> 2002].[school]))
> GROUP BY CostCentres.[Cost centre];
>
> The problem is i want to use wild cards, if i type in e.g test i want to
>
> get all the results with that word, ie test primary, test academy. I
> don't know where to put them. I tried this -
>
> SELECT CostCentres.[Cost centre]
> FROM CostCentres
> WHERE (((CostCentres.[Centre Description]) Like [forms]![period 2 -
> 2001-
> 2002].[*school*]))
> GROUP BY CostCentres.[Cost centre];
>
> Doesn't give me the right results where you run just the query(although
> it
> does give me more than the first query) and it doesn't work in the form.
>
> Get box asking for parameters.
> Is there an easy way of doing this?
>
> ---
> You are currently subscribed to access as: joe@s... To
> unsubscribe send a blank email to $subst('Email.Unsub')
>
>
|
|
 |