need help with sub string

mambo21

New member
Local time
Today, 13:17
Joined
Mar 22, 2005
Messages
9
Hello,

I have a problem with comparing IDs using VBA, for example if i was using MySQL i can write

If Mystring = "g????" then ......

Which means it will only look for all the IDs which start with g. HOw can i do this in VBA?

Cheers
 
"g*"

(You're looking for a g-string :eek: )
 
mambo21 said:
Code:
If Mystring = "g????" Then

Since you are not testing for equality you need to use the Like operator for comparison.

So, what you want is:

Code:
If Mystring Like "g????" Then

-----------------------------------------------------------------------

To Ken, "g????" is perfectly valid. The ? signifies one character where the * signifies multiple characters. So, by using g???? mambo21 is testing if Mystring is a five character string beginning with g. :)
 
I knew that. Guess I was a little over-anxious to offer a solution :o
 
Last edited:

Users who are viewing this thread

Back
Top Bottom