Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querying For/Writing an Expression on a literal "*"

Status
Not open for further replies.

MitchJP

MIS
Feb 17, 2004
43
US
Does anyone know how to make an asterisk literal in a MS Access query??? We've tried encapsulating it in quotation marks, etc, but it hasn't worked. Any help is appreciated!

MitchJP
 
In your query under criteria, if you type "5*" it will change it to like "5*", but if you put ="5*" it will leave it be and force a real match.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Well, it's more complicated than that.

We are querying on a field that is either blank, has some text in it, or has some text in it preceded by an * (so, "*blahblahblah"). We want to grab all records with an * in it. So we don't want to match it to "*" exactly, but look for a wild card ALONG with an *. Ugh.

So maybe 'Like "*"' makes more sense to me... but who knows.

Thanks!
MitchJP
 
I see. Ok, here is what I suggest.

under criteria, put the following:

Like "*Blah Blah Blah*" And Asc(Left([employeenumber],1))

The asc(left thingie will make sure the first charachter is a *. The like *blah* finds like you think, and the and makes it only show records that match both.

Hope that Helps.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top