Forums
This topic is locked
trouble in InStr
Posted 11 Apr 2002 18:13:17
1
has voted
11 Apr 2002 18:13:17 Rick Harding posted:
I am checking a code to see if a string is present.The code format is
three char
followed by a dash
a practice
another dash
a 3 digit number
three random char
ex. MCL-IM-003-FHG
No problem is I want to look and see what the second set of char is.
Ex. the code above has an IM in that spot so I print out "Internal Medicine"
I use
ElseIF InStr((rsMadison.Fields.Item("authcode".Value),"IM" Then
Response.Write "IM"
Now if the last three have IM in them I get this marked to...so it messes up
my system
Ex. MCL-FP-003-IMG would print "Internal Medicine" too.
I have tried using '_', '*', and '?' to limit to checking from the 4th char
on only, but it won't work. How can I specify "any 4 char and then IM print
Internal Medicine"?
Thanks a lot.
Rick Harding
U of M CS Student / Network Admin for MSU FAME
www.ricks-web.info
"Techies just think differently...at least that's what they keep telling me"
Replies
Replied 11 Apr 2002 22:57:22
11 Apr 2002 22:57:22 Owen Eastwick replied:
Try:
ElseIF InStrRev((rsMadison.Fields.Item("authcode".Value),"IM", 7) Then
This wil search from position 7 to the beginning of the string.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
ElseIF InStrRev((rsMadison.Fields.Item("authcode".Value),"IM", 7) Then
This wil search from position 7 to the beginning of the string.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo