Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / January 2006

Tip: Looking for answers? Try searching our database.

Splitting string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 29 Jan 2006 06:39 GMT
Hi

Is there a way to split a multi-line address field into individual lines of
address in access 97?

Thanks

Regards
steve.minnaar - 29 Jan 2006 10:48 GMT
You could use the GetPart function below:

Function GetPart(N As Integer, S As String, D As String) As String
'   Returns a string from character N to the delimiter D
Dim i As Integer
i = InStr(N, S, D)
If i = 0 Then
   GetPart = ""
Else
   GetPart = Mid$(S, N, i - N)
End If
N = i + Len(D)
End Function

.
.
     N = 2
     Me![LastName] = GetPart(N, Address, "~")
     Me![Addr1] = GetPart(N, Address, "~")
     Me![Telephone] = GetPart(N, Address, "~")
     Me![Fax] = GetPart(N, Address, "~") & " "
     Me![E-mail] = GetPart(N, Address, "~") & " "
.
.

In the example I've used ~ as the delimiter. This could be any character
combination e.g. vbCrLf

MS Access - A legend in it's own time.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.