Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple string methods

Status
Not open for further replies.

JPeters

MIS
Jul 25, 2001
423
0
0
US
Hey guys...

I was reluctant to post this on Tek-Tips just yet due to the fact that a simple string method is stumping me. Since I've self-taught myself VBA, I skipped a lot of the basics.

Anyways, I've got a quesiton. I'm working on a MapPoint database again and I'm gettin a small error. I don't know VB as well as I know Java these days and there error is a bit beyond me, but I'm positive that there has to be an extremely easy fix.

Basically the map point automation module that I wrote scrolls through a recordset consisting of address (street), city, state, and zip, oh - and the name of the pushpin location. It then places a pushpin at the correct spot and cycles through to the next record ... looping until the recordset is eof ... err empty .. I still dont know what eof stands for ... end of file? ... Anywho ... I'm having a small problem when the street address is a PO box... it gives me an error and the program halts. IS there a way I can do something like we do in java with the substring() method?

Ie: this is the record name for the street portion of the full address.... and does != work in place of <> in vb for does not equal?

If MapRST!Adress.substring(0, 5) <> &quot;PO BOX&quot; then
....commands to map
end if

This will help ... but im a bit concerned about the stuff in the quotes being case sensitive if it does work. Got any ideas?

Thanks for your time.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
Try
Dim strW as string
strW = Mid(MapRST!Adress,1, 9)
' Maybe take care of &quot;P. O. BOX&quot;
strW = Replace$(strW,&quot;. &quot;,&quot; &quot;)
' Maybe take care of &quot;P.O. BOX&quot;
strW = Replace$(strW,&quot;.&quot;,&quot; &quot;)
strW = Left(strw,7)
If 0 <> StrComp(strW,&quot;P O BOX&quot;,vbTextCompare) then


Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
eof stands for as you tought end of file
i would try
If left(MapRST!Adress,5) <> &quot;PO BOX&quot; then
....commands to map
end if
 
There are 6 characters in &quot;PO BOX&quot; so
Left(MapRST!Adress,5) will never equal &quot;PO BOX&quot;.

I would compare 6 characters and do a case insensitive compare.
If LCase(Left(MapRST!Adress,6)) <> &quot;po box&quot; then
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Guys,

Thank you for the replies... I think I'm going to go ahead and convert the entire street string to uppercase... that way I dont have to check for case sensitive methods.. then im just going to do a search of the first 6 chars of the string to see if they are po box .. . . . I dunno.. I'm gonna do my best with the ammo you guys have given me. I'll let you know if I get stuck again. Thanks for the replies.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top