Solved

problem wit Instr function

Posted on 2014-04-19
6
153 Views
Last Modified: 2014-04-19
If InStr(lbl1,lblCredit, "$") = True Then  this does not work
but this does;  If InStr(1, lblCredit, "$") Then
why?
0
Comment
Question by:isnoend2001
  • 4
  • 2
6 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40010470
In the first one did you mean

InStr(lbl1,lblCredit, "$") = True

or did you mean

InStr(1,lblCredit, "$") = True
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40010477
In any case InStr returns a position and since True is equal to -1, True will never be equal to the position.
0
 

Author Comment

by:isnoend2001
ID: 40010479
Whoops i meant
InStr(1,lblCredit, "$") = True does not work
this does
If InStr(1, lblCredit, "$") Then
using the = True causes it not to work
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40010481
Let me restate what I said. In VB any non-zero value is 'True' but True itself is -1 so the position returned by InStr while non-zero and therefore True can never be = -1.
0
 

Author Closing Comment

by:isnoend2001
ID: 40010484
thanks, learn something new everyday
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40010489
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

832 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