I am working on a database where the front and back end need to remain unlinked from each other to limit the bandwidth as much as possible across a server. However this means I need to connect into the back end using code and set up arrays of table data. I wish to run an SQL statement to create a list of IDs and names, put these values into an array and then populate a combo box with the array.
I can create the array of values from the SQL statement fine however when I try to put the array in the combo box only the final array line is displayed in the drop down list, not all lines. The code I am using is as follows:
'Set up array
ReDim aCombo(2, 0)
'Add recordset lines to the array
Do While Not rsTemp.EOF
ReDim Preserve aCombo(2, lRecordCount)
aCombo(1, lRecordCount) = rsTemp(0)
aCombo(2, lRecordCount) = rsTemp(1)
lRecordCount = UBound(aCombo, 2) + 1
rsTemp.MoveNext
Loop
'Set combo box rowsource to the array
cboTemp.RowSource = aCombo(2, 2)
Does anyone know what I am doing wrong and how to add all the array values to the drop down list? Or is there an alternative way of doing this?
I can create the array of values from the SQL statement fine however when I try to put the array in the combo box only the final array line is displayed in the drop down list, not all lines. The code I am using is as follows:
'Set up array
ReDim aCombo(2, 0)
'Add recordset lines to the array
Do While Not rsTemp.EOF
ReDim Preserve aCombo(2, lRecordCount)
aCombo(1, lRecordCount) = rsTemp(0)
aCombo(2, lRecordCount) = rsTemp(1)
lRecordCount = UBound(aCombo, 2) + 1
rsTemp.MoveNext
Loop
'Set combo box rowsource to the array
cboTemp.RowSource = aCombo(2, 2)
Does anyone know what I am doing wrong and how to add all the array values to the drop down list? Or is there an alternative way of doing this?