Join Method Problem

D

DracKewl

Hey All,

I could do this another way but want to know why using the JOIN function
will not work.
Join(sourcearray[, delimiter])

My Code:
Dim test as String
test = Join(gConCatalogue.ConvRS.GetRows(, 1, 0), [,])

What I'm doing is taking all the items from one column in an ADO recordset
and passing it with comma delimited into a string. But this does not work.

Any ideas?
 
B

Brendan Reynolds

The square brackets aren't part of the syntax, they indicate that what's
between them is optional. Try "," instead of [,].
 
D

DracKewl

I get an error:
Can't asign to array.

Brendan Reynolds said:
The square brackets aren't part of the syntax, they indicate that what's
between them is optional. Try "," instead of [,].

--
Brendan Reynolds
Access MVP


DracKewl said:
Hey All,

I could do this another way but want to know why using the JOIN function
will not work.
Join(sourcearray[, delimiter])

My Code:
Dim test as String
test = Join(gConCatalogue.ConvRS.GetRows(, 1, 0), [,])

What I'm doing is taking all the items from one column in an ADO recordset
and passing it with comma delimited into a string. But this does not
work.

Any ideas?
 
D

DracKewl

Got sick of trying to make it work. Created my own function.
Here is the call
CommaDelString(gConCatalogue.ConvRS.GetRows(, 1, 0),
gConCatalogue.ConvRS.RecordCount)

Private Function CommaDelString(recset As Variant, count As Integer) As String
Dim intCount As Integer
Dim strString As String
intCount = 0
Do
strString = strString & recset(0, intCount) & ","
intCount = intCount + 1
Loop While intCount < (count - 1)

strString = strString & recset(0, intCount)
CommaDelString = strString

End Function

DracKewl said:
I get an error:
Can't asign to array.

Brendan Reynolds said:
The square brackets aren't part of the syntax, they indicate that what's
between them is optional. Try "," instead of [,].

--
Brendan Reynolds
Access MVP


DracKewl said:
Hey All,

I could do this another way but want to know why using the JOIN function
will not work.
Join(sourcearray[, delimiter])

My Code:
Dim test as String
test = Join(gConCatalogue.ConvRS.GetRows(, 1, 0), [,])

What I'm doing is taking all the items from one column in an ADO recordset
and passing it with comma delimited into a string. But this does not
work.

Any ideas?
 

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