Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Array

0 views
Skip to first unread message

Mike

unread,
Nov 11, 2007, 8:59:00 PM11/11/07
to
I'm trying to pass the REG_Z_COUNTER in an Array Can some shed some light on
this for me
Thanks Mike
SQL1 = "SELECT TENDSALE.REG_Z_COUNTER " _
& "FROM TENDSALE " _
& "GROUP BY TENDSALE.REG_Z_COUNTER;"

John Nurick

unread,
Nov 12, 2007, 2:20:12 AM11/12/07
to
Hi Mike,

I'm not sure what you mean by 'pass'. If you're trying to bind the
column TENDSALE.REG_Z_COUNTER to an array, you can't do that sort of
thing in VBA.

Things you can do, depending on what you're trying to achieve:

1) Open a recordset, e.g.
Dim R As DAO.Recordset
Set R = CurrentDB.OpenRecordset( _
"SELECT REG_Z_COUNTER FROM TENDSALE ORDER BY XXX;")
and then pass the recordset.

2) Open a recordset, iterate through it appending each value to an
array, e.g.
Dim A As String()
Dim R As DAO.Recordset
Dim j As Long

Set R = CurrentDB.OpenRecordset( _
"SELECT REG_Z_COUNTER FROM TENDSALE ORDER BY XXX;")
R.MoveLast
R.MoveFirst
Redim A(R.RecCount - 1)
For j = 0 to UBound(A)
A(j) = R.Fields(0).Value
R.MoveNext
Next
R.Close

and pass the array; later you can reverse the process and write values
back from the array into the table.

3) As for (2), but concatenate the values into a delimited string.

--
John Nurick - Access MVP

Mike

unread,
Nov 12, 2007, 7:17:03 AM11/12/07
to
Thanks John
0 new messages