Solved

Instr Type Mismatch

Posted on 2009-03-31
10
485 Views
Last Modified: 2013-11-27



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
0
Comment
Question by:keschuster
  • 5
  • 3
  • 2
10 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24030876

try this

InStr(rsCol("Client Name"), vArr(j))
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24030884
or

try this

InStr(rsCol("[Client Name]"), vArr(j))
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24030902
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 24030908
You need to specify the "Start" for the comparison:

InStr(1, rsCol("Client Name"), (vArr(j)), 1)  '<--- to start at the first character
0
 
LVL 61

Expert Comment

by:mbizup
ID: 24030946
Sorry...  I always include the start in my syntax, but double-checking the Help file - it is optional, defaulting to 1.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24030966


yes you are correct miriam,
if the Compare is use, you have to specify the start argument
0
 
LVL 61

Expert Comment

by:mbizup
ID: 24030983
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
 
LVL 61

Expert Comment

by:mbizup
ID: 24030998
Thx, Rey... very slow connection today :)
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24031056
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
 
LVL 61

Expert Comment

by:mbizup
ID: 24031270
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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question