Hi
Please can anyone help I need to populate a combo box with the results returned froma stord Proc.
My code so FAR is
[vbcode]
Public Function ContactDetails()
Dim rsSet As ADODB.Recordset
Dim ObjCmd As Command
Set rsSet = New ADODB.Recordset
With rsSet
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
End With
Set ObjCmd = New Command
With ObjCmd
.ActiveConnection = gBass
.CommandType = adCmdStoredProc
.CommandText = "upSel_ContactDetails"
.Parameters.Append .CreateParameter("@AcNo", adVarChar, adParamInput,
40, AC_NO)
End With
Set rsSet = ObjCmd.Execute
CmboContact.RowSourceType = "value list"
CmboContact.RowSource = BuildComboList(rsSet)
End Function
Private Function BuildComboList(rs As ADODB.Recordset)
Dim OutStr As String
Do While Not rs.EOF()
OutStr = OutStr & """" & rs!AC_NO & """" & ";" & """" & rs!Contact_char &
"""" & ";"
rs.MoveNext
Loop
CmboContact = OutStr
End Function
[/vbcode]
Thanks for your help!!!![]()




Reply With Quote