You can use the Instr() function, combines wuth the Chr() function to fund special characters - the line returns will be 10 or 13 - and then split each field into various variables using the Left() and Mid() test handlers.
I dont have a bit of code written at the moment, but it isnt too bad to do. You can even use the text functions in an update, append or make-table query.
It must be delimited somehow or you won't be able to split it using a programme. If you can form a set of rules as to how the data is made up, then you can split it.
It looks like townname space(s) stateabbreviation space(s) somenumber ? Peter Meachem
peter@accuflight.com
You might want to consider a 'right to left' approach, which
will allow you to deal with the possibility that the city name
consists of more than one word (e.g. "West Palm Beach".
This solution assumes that your state or territory abbreviation
never contains spaces:
Copy function xLastInStr() - shown below - to a module. Then,
from the debug window:
*******************************************************************
' FUNCTION: xLastInStr()
'
' PURPOSE: Determine the position of the last character(s)
' (as specified by user) in a string.
'
' ARGUMENTS:
' tstr: The string to be tested
' twhat: The character to locate.
'
' RETURNS: An integer representing the last occurence or, if not found, 0.
'
' NOTES: To test: Type '? xLastInStr("The quick brown fox jumped over
' the lazy dog", "the" in the debug window.
' The function will return 33.
Function xLastInStr(ByVal tstr As String, twhat As String) As Integer
Dim I As Integer, n As Integer, tlen As Integer
n = 0
tlen = Len(twhat)
For I = Len(RTrim(tstr)) To 1 Step -1
If Mid(tstr, I, tlen) = twhat Then
n = I
Exit For
End If
Next I
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.