Referencing ASCII Character

rjusa

New member
Local time
Today, 07:30
Joined
Feb 27, 2003
Messages
7
Background: This beast of a problem came about when an Outlook Contacts folder was exported to a Table in Access. Since Outlook allows for muliple lines in the "Address" field, the information doesn't make sense in Access, which only allows single line input. So, I've written the following code:

Sub Macro69()
Dim Mystring As String, MyArray, Msg, x As Integer
Dim iLP As Integer
DoCmd.OpenForm "Outlook1"
Mystring = Forms!Outlook1!Address1
MyArray = Split(Mystring, "*", -1, 1)
For iLP = LBound(MyArray) To UBound(MyArray)
Msg = MyArray(iLP)
MsgBox Msg
Next iLP
'x = Asc(Mid(Mystring, 22, 1))
'MsgBox x
End Sub

What I did to test the little bugger was edit the exported "Address" and put in a "*" between the text so my Address field looked like

Euro*Canadian Center|Marlborough Street

which returns

Euro (...1 field)
Canadian Center
Marlborough Street (...2&3 lines 1 field)

So here's my dilema. In the line "...Center|Marlborough..." the "|" is a character generated from Outlook(I'm guessing it's like a CR since Marlborough is displayed as a new line) I've identified the characters' ASCII equivalent = 10. In the line

MyArray = Split(Mystring, "*", -1, 1)

how would I replace the "*" with the ASCII reference? If this is possible what I'll have is the muti-line Address parsed into 3 seperate fields and life would be good!
 
try:

MyArray = Split(Mystring, Chr(10), -1, 1)
 
Last edited:
MyArray = Split(Mystring, Chr(10), -1, 1)
works just fine! Thanks. But what happens is the routine only runs on the first record when the Form is closed or on the current record when the Form is open. How do I get it to loop(?) through all the records in the form?
 
Don't have time to answer propely as finishing work just now.

Look up the OnCurrent event of a form.
 

Users who are viewing this thread

Back
Top Bottom