Sign Up |  Live StatsLive Stats    Articles 34,880| Comments 154,874| Members 17,231, Newest 1stmanjeet| Online 294
Home Contact
 (Forgotten?): 
    Sikhism

   
                                                                     Your Banner Here!    

 
 
  
  
Sikh Philosophy Network » Members Lounge » Information Technology » InStr function error driving me around the bend.

InStr function error driving me around the bend.

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 400 USD, Received: 25 USD (6%)
Please Donate...
Related Topics...
Thread Thread Starter Forum Replies Last Post
Growing Central Indiana Sikh Population Has 3rd Temple Planned (22 WSBT South Bend) Sikh News Reporter Sikh News 0 19-Oct-2007 04:10 AM
Instr function not defined--- Version conflict? JoeA2006 Information Technology 6 28-Jul-2006 08:42 AM
Error 3085: Undefined function 'StrReverse' in expression. Teresa Information Technology 10 28-Jul-2006 08:36 AM
Getting error because query contains a function Domac Information Technology 5 28-Jul-2006 08:18 AM
Giving them a chance (South Bend Tribune) Neutral Singh Christianity 0 25-Jun-2005 19:18 PM


Tags
instr, function, error, driving, around, bend
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:13 AM
DaBartman's Avatar DaBartman
Guest
 
Posts: n/a
   
   
InStr function error driving me around the bend.

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I am quite puzzled by the error I when this function gets called:
Runtime error "13"
Type mismatch
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10504-instr-function-error-driving-around-bend.html

The error is triggered by the InStr function

Public Function IsNoLimit(gn As String) As Boolean

Dim gnp As String

If InStr(gn, "No Limit", vbTextCompare) > 0 Then <<< offending line of
code
IsNoLimit = True
Else
IsNoLimit = False
End If

End Function

All I want it to do is tell me if the string "No Limit" was found; InStr >0
as in gn = " 5/10 No Limit Holdem" where InStr would be 6 or "Omaha8: Limit
6/12" where InStr should be 0 as "No Limit" was not found within the search
string gn.

The help files tell me that the return data type of the InStr function is
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
Varient (Long). I have tried using a variable to return the InStr function to
(such as gnnl) and dimmsioning the variable to Varient and Long. The error
has always been the same which is why you see the current code attempt above.
Same error.

Anyone out there have any ideas as to why I get this error and any solutions
to it?

Much thanks for reading this somewhat lengthly post,
Bart



 
Do share your immediate thoughts or reactions on this issue? We value your views! Login Now! or Sign Up Today! to share your views with us.. Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:13 AM
Allen Browne's Avatar Allen Browne
Guest
 
Posts: n/a
   
   
Re: InStr function error driving me around the bend.

Yes, that's confusing.

The issue is that all 4 arguments of Instr() are optional, and you must
include the first (the starting position) when you include the last (the
compare type.)

Try:
If InStr(1, gn, "No Limit", vbTextCompare) > 0 Then

Or perhaps just:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
IsNoLimit = (InStr(1, gn, "No Limit", vbTextCompare) = 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DaBartman" wrote in message
news:3C193C95-510C-47DD-9F1E-6D29C8D8D5FF@microsoft.com...
>I am quite puzzled by the error I when this function gets called:
> Runtime error "13"
> Type mismatch
>
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
> The error is triggered by the InStr function
>
> Public Function IsNoLimit(gn As String) As Boolean
>
> Dim gnp As String
>
> If InStr(gn, "No Limit", vbTextCompare) > 0 Then <<< offending line of
> code
> IsNoLimit = True
> Else
> IsNoLimit = False
> End If
>
> End Function
>
> All I want it to do is tell me if the string "No Limit" was found; InStr
> >0

> as in gn = " 5/10 No Limit Holdem" where InStr would be 6 or "Omaha8:
> Limit
> 6/12" where InStr should be 0 as "No Limit" was not found within the
> search
> string gn.
>
> The help files tell me that the return data type of the InStr function is
> Varient (Long). I have tried using a variable to return the InStr function
> to
> (such as gnnl) and dimmsioning the variable to Varient and Long. The error
> has always been the same which is why you see the current code attempt
> above.
> Same error.
>
> Anyone out there have any ideas as to why I get this error and any
> solutions
> to it?
>
> Much thanks for reading this somewhat lengthly post,
> Bart



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:13 AM
Matthias Klaey's Avatar Matthias Klaey
Guest
 
Posts: n/a
   
   
Re: InStr function error driving me around the bend.

DaBartman wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504

>I am quite puzzled by the error I when this function gets called:
>Runtime error "13"
>Type mismatch
>
>The error is triggered by the InStr function
>
>Public Function IsNoLimit(gn As String) As Boolean
>
> Dim gnp As String
>
> If InStr(gn, "No Limit", vbTextCompare) > 0 Then <<< offending line of

[...]

Try If InStr(1, gn, "No Limit", vbTextCompare) > 0 Then

If you use the compare option, you need to give the start argument.
This is perhaps one of the weirdest synatx rules in VB, so don't feel
bad
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504

HTH
Matthias Kläy
--
www.kcc.ch

Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:13 AM
DaBartman's Avatar DaBartman
Guest
 
Posts: n/a
   
   
Re: InStr function error driving me around the bend.

Problem solved by both of you. Thanks,
Bart

"Matthias Klaey" wrote:

> DaBartman wrote:
>
> >I am quite puzzled by the error I when this function gets called:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
> >Runtime error "13"
> >Type mismatch
> >
> >The error is triggered by the InStr function
> >
> >Public Function IsNoLimit(gn As String) As Boolean
> >
> > Dim gnp As String
> >
> > If InStr(gn, "No Limit", vbTextCompare) > 0 Then <<< offending line of

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
> [...]
>
> Try If InStr(1, gn, "No Limit", vbTextCompare) > 0 Then
>
> If you use the compare option, you need to give the start argument.
> This is perhaps one of the weirdest synatx rules in VB, so don't feel
> bad
>
> HTH
> Matthias Kläy
> --
> www.kcc.ch
>
>

Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:13 AM
david epsom dot com dot au's Avatar david epsom dot com dot au
Guest
 
Posts: n/a
   
   
Re: InStr function error driving me around the bend.

  Donate Today!  
vbTextCompare is the default value in Access.

If InStr(gn,"No Limit")

This is what the line:
Option Compare Database
at the top of every module means.

(david)

"DaBartman" wrote in message
news:3C193C95-510C-47DD-9F1E-6D29C8D8D5FF@microsoft.com...
>I am quite puzzled by the error I when this function gets called:
> Runtime error "13"
> Type mismatch
>
> The error is triggered by the InStr function
>
> Public Function IsNoLimit(gn As String) As Boolean
>
> Dim gnp As String
>
> If InStr(gn, "No Limit", vbTextCompare) > 0 Then <<< offending line of
> code
> IsNoLimit = True
> Else
> IsNoLimit = False
> End If
>
> End Function
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
>
> All I want it to do is tell me if the string "No Limit" was found; InStr
> >0

> as in gn = " 5/10 No Limit Holdem" where InStr would be 6 or "Omaha8:
> Limit
> 6/12" where InStr should be 0 as "No Limit" was not found within the
> search
> string gn.
>
> The help files tell me that the return data type of the InStr function is
> Varient (Long). I have tried using a variable to return the InStr function
> to
> (such as gnnl) and dimmsioning the variable to Varient and Long. The error
> has always been the same which is why you see the current code attempt
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10504
> above.
> Same error.
>
> Anyone out there have any ideas as to why I get this error and any
> solutions
> to it?
>
> Much thanks for reading this somewhat lengthly post,
> Bart



Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Gurbani Jukebox
Listen to Gurbani while surfing SPN!
» Recent Discussions
sikhism Undercover Mosque
Today 13:14 PM
1 Replies, 55 Views
sikhism Eighteen Super-Natural...
Today 13:11 PM
31 Replies, 3,450 Views
sikhism Mysticism In Religion:...
Today 12:57 PM
3 Replies, 1,001 Views
sikhism What Prayer Does to Your...
Today 12:21 PM
3 Replies, 281 Views
sikhism Four Steps To God
Today 12:11 PM
2 Replies, 236 Views
sikhism Benti Chaupai - Keertan...
Today 11:53 AM
17 Replies, 276 Views
sikhism Fools Who Wrangle Over...
Today 11:46 AM
917 Replies, 77,938 Views
sikhism Incidental Happiness...
Today 10:24 AM
1 Replies, 78 Views
sikhism Meditate - How, What,...
Today 08:30 AM
41 Replies, 1,193 Views
sikhism Are Nihangs: A Legacy...
Today 08:12 AM
15 Replies, 269 Views
sikhism Sukhmani Sahib Astpadi 8...
Today 06:38 AM
0 Replies, 27 Views
sikhism Is Hindu/Sikh a Valid...
Today 02:20 AM
82 Replies, 1,482 Views
sikhism Amazing truth!
Yesterday 22:20 PM
0 Replies, 73 Views
sikhism Black money: Indians...
Yesterday 21:40 PM
1 Replies, 61 Views
sikhism Sikh temple brawl a...
Yesterday 20:33 PM
0 Replies, 69 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.2

All times are GMT +6.5. The time now is 13:34 PM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.41613 seconds with 30 queries