use of '*' jolly character

G

gianni rugg

Is it possible to define the jolly character '*' (star) as a query field's
criteria at run time? How?
 
J

John W. Vinson

On Mon, 13 Aug 2007 02:02:02 -0700, gianni rugg <gianni
Is it possible to define the jolly character '*' (star) as a query field's
criteria at run time? How?

If you're looking for a field containing only one character, an asterisk,

WHERE fieldname = "*"

or equivalently just

"*"

in the criteria line will work.

If you're looking for an asterisk anywhere within a text string, you need to
bracket the search criterion to force Access to take it as a literal rather
than a wildcard:

LIKE "*[*]*"

The first and last asterisks are wildcards, matching any string; the one in
brackets is taken as the literal character.

John W. Vinson [MVP]
 
G

gianni rugg

Really, I am interested to define, at run time, the jolly character '*' as a
query field's criteria...
Anyway, thanks for your help
Gianni Ruggieri

John W. Vinson said:
On Mon, 13 Aug 2007 02:02:02 -0700, gianni rugg <gianni
Is it possible to define the jolly character '*' (star) as a query field's
criteria at run time? How?

If you're looking for a field containing only one character, an asterisk,

WHERE fieldname = "*"

or equivalently just

"*"

in the criteria line will work.

If you're looking for an asterisk anywhere within a text string, you need to
bracket the search criterion to force Access to take it as a literal rather
than a wildcard:

LIKE "*[*]*"

The first and last asterisks are wildcards, matching any string; the one in
brackets is taken as the literal character.

John W. Vinson [MVP]
 
J

John W. Vinson

Really, I am interested to define, at run time, the jolly character '*' as a
query field's criteria...

And that is precisely what I told you how to do.

I guess I don't understand the problem.

John W. Vinson [MVP]
 
B

BonnieW via AccessMonster.com

Are you saying that you have fields which include the * as part of their data,
and you'd like to find these fields? Not that you're looking to use * as a
wildcard?


gianni said:
Really, I am interested to define, at run time, the jolly character '*' as a
query field's criteria...
Anyway, thanks for your help
Gianni Ruggieri
[quoted text clipped - 19 lines]
John W. Vinson [MVP]
 
G

gianni rugg

My problem is the following. I have a table with N fields: so, there are (2^N
- 1) not empty subsets. For each subset, I need to calculate the intersection
recordset. My idea was to design a unique query, wich a criteria for each
field: but such criteria have to be established at run time, based on the
selected checkbox! If a checkbox is not selected, the related criteria has to
be the wildcard *, with its jolly meaning.

BonnieW via AccessMonster.com said:
Are you saying that you have fields which include the * as part of their data,
and you'd like to find these fields? Not that you're looking to use * as a
wildcard?


gianni said:
Really, I am interested to define, at run time, the jolly character '*' as a
query field's criteria...
Anyway, thanks for your help
Gianni Ruggieri
Is it possible to define the jolly character '*' (star) as a query field's
criteria at run time? How?
[quoted text clipped - 19 lines]
John W. Vinson [MVP]
 
J

John W. Vinson

My problem is the following. I have a table with N fields: so, there are (2^N
- 1) not empty subsets. For each subset, I need to calculate the intersection
recordset. My idea was to design a unique query, wich a criteria for each
field: but such criteria have to be established at run time, based on the
selected checkbox! If a checkbox is not selected, the related criteria has to
be the wildcard *, with its jolly meaning.

There's a much better option.

Rather than using wildcards and the LIKE operator, build up the SQL string in
VBA code. If a given field needs a criterion, include it in the building
string; if it doesn't, just leave it out (rather than putting it in with a
wildcard).

John W. Vinson [MVP]
 
Top