By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

spliting the address line!

P: n/a
Hi
How to split an address field up, when the user has entered it in one field
with each address line separated by carriage return.

I like to have a button, which can be clicked to autofill the address lines
to related controls/fields on the form.

How do I do that?

Regards
Nathan
Aug 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You can use something like this:

Private Sub Command4_Click()
Dim varAddress As Variant
Dim intCounter As Integer

varAddress = Split(Me.Address, vbCrLf)
For intCounter = LBound(varAddress) To UBound(varAddress)
MsgBox "Line (" & intCounter & "): " & varAddress(intCounter)
Next intCounter
End Sub

and then set the value of the various fields. The problem is that
addresses are really inconsistent. Different numbers of lines etc. I
guess you could use the ubound(varArray) function to get the number of
items in the array and then make a decision on how to handle the parts
that way, but it won't be neat and easy.

Aug 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.