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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for a wildcard

Status
Not open for further replies.

sdb0812

Programmer
May 29, 2003
14
US
Is there any way you can search a particular field in a table and find a wildcard? In my case, there are records that begin the the character "*" and I need to find them all. Everything I have tried thus far is using the "*" as a wildcard and is not searching for the literal "*".

Can this be done, and if so....how?

thanks,
sdb0812
 
Try enclosing the wildcard character in brackets for certain types of searches or use a function like instr.

instr(myfield,"[*]") > 0

Did you try

instr(myfield,"*") > 0
 
cmmrfrds,

I tried using the instr function but it wouldn't work with the "*". I tried another character that is in my data, which is the "(" and it was found, but the "*" is still eluding me.

 
I tried this simple test and it found the * in position 4.


Dim var As String, int1 as integer
var = "sss*aaa"
int1 = InStr(1, var, "*", vbTextCompare)
Debug.Print "instr compare = "; int1

 
It worked like a champion including the start position. Thank you...I didn't think this would ever work!!

hats off and giving props to cmmrfrds

sdb0812
 
cmmrfrds

I posted thread220-587983 but have not gotten any answers.

Care to take a stab at it?

Thanks! (either way....)

"The potentialities of a language are so vast that we must wonder sometimes at ourselves: how do we manage to know so much?" Anthony Burgess, A Mouthful of Air
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top