Hi Devil666, (Nice name :-) )
When trying your code I get "compile error: can't asign to array".
Remember i'm only using VB6
Main Topics
Browse All TopicsHi,
I need to load a string array from a single recordset field that contains vbCRLFs in VB6.
The idea is to break down these rs fields into lines so that I can create a neat plain text email with the information next to each other. (Don't know HTML yet)
So far I have this:
'InStrCount counts the amount of specified delimiters from a certain position
'Rsado is the name of the recordset
Dim bytI As Byte
Dim bytSplits As Byte
Dim strMN(15) As String
Dim varMN(15) As Variant
bytSplits = InStrCount(rsado!MN, vbCRLF, 1) + 1
For bytI = 0 To bytSplits
strMN(bytI) = Split(rsADO!MN, vbCrLf, bytI, vbTextCompare)
Next
This code keeps returning "runtime error 13 Type mismatch".
I have read a few articles and check out other code, none have the answer I need.
It does work if I use a variant array, but I can't see the information in the array. So I don't know if it's working or not.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Nope, can't dim strmn() as array
using the variant array your way didn't work either.
Also strMN() = Split(rsADO!MN, vbCrLf, bytI) didn't work
The variant array did work when using the loop, but the message boxes are empty.
Dim varMN(15) As Variant
bytSplits = InStrCount(strTemp, "*", 1) + 1
For bytI = 0 To bytSplits
varMN(bytI) = Split(rsADO!MN, vbCrLf, bytI, vbTextCompare)
Next
For bytI = 0 To UBound(varMN)
MsgBox strMN(bytI) '!!!! returns empty messageboxes
Next
I am looking into this function:
http://www.freevbcode.com/
Business Accounts
Answer for Membership
by: Devil666Posted on 2007-06-25 at 04:33:57ID: 19354756
hi there,
the following should be
strMN = Split(rsADO!MN, vbCrLf, bytI, vbTextCompare)
that would populate your entire array, you dont need the for loop.
to view it,
Dim i as int
For i = 0 to UBOUND(strMN)
msgbox strMN(i)
NEXT
hth