Instr Type Mismatch




I'm getting a type mismatch when I add the textual comparison switch to the following

InStr(rsCol("Client Name"), (vArr(j)), 1)

The values are:ClientName:Autauga County Treasurer
SearchTerm:ALABAMA
keschusterAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mbizupConnect With a Mentor Commented:
You need to specify the "Start" for the comparison:

InStr(1, rsCol("Client Name"), (vArr(j)), 1)  '<--- to start at the first character
0
 
Rey Obrero (Capricorn1)Commented:

try this

InStr(rsCol("Client Name"), vArr(j))
0
 
Rey Obrero (Capricorn1)Commented:
or

try this

InStr(rsCol("[Client Name]"), vArr(j))
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
TextReportCommented:
The syntax InStr(rsCol("Client Name"), (vArr(j)), 1) looks correct but what are you doing with it, you need to provide the full line of code includinmg the value of J and the value of vArr(j)

If you Debug.Print InStr(rsCol("Client Name"), (vArr(j)), 1) do you get the error?

Cheers, Andrew
0
 
mbizupCommented:
Sorry...  I always include the start in my syntax, but double-checking the Help file - it is optional, defaulting to 1.
0
 
Rey Obrero (Capricorn1)Commented:


yes you are correct miriam,
if the Compare is use, you have to specify the start argument
0
 
mbizupCommented:
Take three (and sorry for all the posts)

From VBA Help:
"The start argument is required if compare is specified."

So it sounds like you DO need the start parameter if you are specifying Text Compare.
0
 
mbizupCommented:
Thx, Rey... very slow connection today :)
0
 
TextReportCommented:
Hi Miriam, new one on me, shows how ofter I use anything other than the default comparison, that will be never then.
Cheers, Andrew
0
 
mbizupCommented:
Andrew,

<shows how ofter I use anything other than the default comparison>

Lol!  I never use anything else either :-)

I don't know how/why I picked up the habit of using the Start parameter.  I always assumed it was required.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.