find "*" in a string

  • Thread starter Thread starter vtj
  • Start date Start date
V

vtj

I need to find the wildcard character * in a string. Because it is text it
needs quotes but then it returns everything because it is a wildcard. There
has to be a way to look for it but I haven't been able to find it. Thanks
for helping.
 
I think you're going to need to search for the Asc number of the character.

The Asc() function I believe returns the number, and then you should be able
to use Chr() to find the value? I'm not 100% on this but I think its right.

"WHERE field = """ & Chr(Asc("*")) & """"

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
That might be more along the lines of this:

"WHERE field = Chr(" & Asc("*") & ")"

This would result in the following where condition:

WHERE field = Chr(SumNumber)

which may be what the SQL statement needs... not really positive how to work
the syntax on this one.
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Use criteria as follows if you are trying to find strings where the asterisk
(*) is present:
Like "*[*]*"

If you want the location within a string, use the VBA INSTR function
Instr(1,[SomeString],"*")
will return a value indicating the position of the asterisk in the string. It
will return 0 if the asterisk is not in the string.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top