Solved

Instr Type Mismatch

Posted on 2009-03-31
10
484 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 119

Expert Comment

by:Rey Obrero
ID: 24030876

try this

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

Expert Comment

by:Rey Obrero
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
 
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
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.

 
LVL 119

Expert Comment

by:Rey Obrero
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now