Split Fields on a DAO Recordset?

M

MDW

I have a rather unusual request.

Say I've got a DAO recordset, and I know that every item in field J contains
text in the format "text1";"text2". What I'd like to do is break that field
into seperate fields, J and J + 1, using the semicolon as the split point.

This is entirely happening in code, there are no forms or tables. The
recordset is being created from a query. Unfortunately, it seems like there's
a limit in the number of fields you can have in a query, and I'm bumping into
it, so I can't perform any sort of splitting action within the query itself.

So what I'd like is something like this. Before conversion:

objRS(1) = "text1;text2"
objRS(2) = "unrelated"
objRS(3) = 123
....

After conversion

objRS(1) = "text1"
objRS(2) = "text2"
objRS(3) = "unrelated"
objRS(4) = 123
....

I hope that makes sense...
 
D

DBS

From your description, I'm not really clear where

objRS(3) = "unrelated"
objRS(4) = 123

are coming from, but as far as splitting "test1;test2"
goes, I'd suggest using the Split function. For example:
_____

Public Function testsplit()

Dim resultarray() As String

resultarray = Split("test1;test2", ";")

MsgBox resultarray(0)
MsgBox resultarray(1)

End Function
_____

Hope that helps!

DBS (David Staas)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top