need help w/ LIKE and a parameter

  • Thread starter Thread starter scenic_man
  • Start date Start date
S

scenic_man

I have a query called, say, "foo",
which is just a join of tables "x", "y", and "z",
with a couple of redundant index fields not included.

Basically, I want to look at *only* this query,
not the underlying tables.

All of the fields in "foo" are of type "Text" except "g",
which is of type "Memo".

I have created a bunch of queries that looks like this:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.a)=[A?"]));
--------
These all work. For these, I am interested only in exact matches.

However, for field "g" I want a wildcard match.
I cooked up the following:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.g) Like '%'+[G contains?]+'%'));
--------
It doesn't work, of course.
I get the little "Enter Parameter Value" dialog box,
and I enter a value that is contained in the "g" field of many rows, but:
When I click the [OK] button,
I get a table with the appropriate column headings,
and one blank row, and then nothing.

Note that I'm just building ordinary conditiona queries here.
I'm not interested in forms or reports at this time --
I'll get to that later.

Can anyone tell me what I *should* be doing?

Thanks.
 
If your query is running under DAO, * is the wildcard character. See whether
using * as the wildcard character (rather than %) works any better.
 
I have a query called, say, "foo",
which is just a join of tables "x", "y", and "z",
with a couple of redundant index fields not included.

Basically, I want to look at *only* this query,
not the underlying tables.

The query has no independent existance. If you want to look at the
data you MUST look at the tables, because that's where the data is. A
Query is just a way to select and combine data from one or more
tables.
All of the fields in "foo" are of type "Text" except "g",
which is of type "Memo".

I have created a bunch of queries that looks like this:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.a)=[A?"]));
--------
These all work. For these, I am interested only in exact matches.

However, for field "g" I want a wildcard match.
I cooked up the following:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.g) Like '%'+[G contains?]+'%'));
--------

In Access, you need to use * rather than % as the wildcard character.

John W. Vinson [MVP]
 
Back
Top