I have created a combobox that is filled by an ADO recordset, which is based on
the value of another recordset. ie comboboxB items are created based on
selection of comboboxA. This part is currently working fine. However, no matter
which item I select in comboboxB its value remains the same. Can someone help
debug my code as I cant find a solution anywhere.
COMBOBOX is filled using function
--------------------------------------------------------------------------------\
-----
Private Function cboAnalysisLoad(cboDatabase As String)
ConnectDB
Set objSourceRS = New ADODB.Recordset
With objSourceRS
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
.ActiveConnection = objConn
End With
gstrSQL = "SELECT Name, Description, Rundate, ID FROM " & cboDatabase &
".dbo.RDM_ANALYSIS RDM_ANALYSIS WHERE EXPOSURETYPE in (8017,8029) ORDER BY Name,
Rundate"
objSourceRS.Open gstrSQL
With cboAnalysis
.Clear
Do While Not objSourceRS.EOF
.AddItem objSourceRS.Fields("Name").Value
.List(0, 1) = objSourceRS.Fields("Description").Value
.List(0, 2) = objSourceRS.Fields("Rundate").Value
.List(0, 3) = objSourceRS.Fields("ID").Value
objSourceRS.MoveNext
Loop
End With
objSourceRS.Close
End Function