Wildcards in records possible?

R

Ralph Hersener

I'm trying to query a table with an exact expression, where the table
contains values with wildcards.

I.e. search for: "ab1234"

records in db:
cd2345
de4567
ab1xx4

The record "ab1xx4" should be returned, as it matches most of the criteria
("x" would be the wildcard for any number, could also be any other string).

Does anyone know, how I could search the database (maybe with a selfwritten
function?) and how the wildcards could look like?

Thank you all very much in advance!

Ralph
 
J

John Vinson

I'm trying to query a table with an exact expression, where the table
contains values with wildcards.

I.e. search for: "ab1234"

records in db:
cd2345
de4567
ab1xx4

The record "ab1xx4" should be returned, as it matches most of the criteria
("x" would be the wildcard for any number, could also be any other string).

The LIKE operator accepts wildcards; normally you would have specific
values in the table and wildcards in the search expression BUT you can
do it the other way! If you use valid wilcard characters - ? for any
character, # for any digit - you could store

ab1##4

in the table, and use a query expression

WHERE "AB1234" LIKE [fieldname]
 
R

Ralph Hersener

Phantastic! This way it works. Btw, on my Access-ODBC-configuration I need
to put an underscore into the fields as the one-character-wildcard
("ab1__4").

John, thank you very much for helping me on that one!

Best regards,
Ralph

John Vinson said:
I'm trying to query a table with an exact expression, where the table
contains values with wildcards.

I.e. search for: "ab1234"

records in db:
cd2345
de4567
ab1xx4

The record "ab1xx4" should be returned, as it matches most of the criteria
("x" would be the wildcard for any number, could also be any other
string).

The LIKE operator accepts wildcards; normally you would have specific
values in the table and wildcards in the search expression BUT you can
do it the other way! If you use valid wilcard characters - ? for any
character, # for any digit - you could store

ab1##4

in the table, and use a query expression

WHERE "AB1234" LIKE [fieldname]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top