VB Rookie here,
I have created an ActiveX DLL in VB 6.0 that uses an interface and passes a recordset. It looks something like this:
I have created an ActiveX DLL in VB 6.0 that uses an interface and passes a recordset. It looks something like this:
Code:
Private Function IClient_getClients() As ADODB.Recordset
Dim sql, login_Name As String
On Error GoTo ErrHandler
Call openConnection(adoConnection)
If (adoConnection.State) Then
sql = "select * " & _
"from client_info " & _
"order by client_name"
Call openRecordSet(adoConnection, IClient_getClients, sql)
Set IClient_getClients = adoRecordset
'~~~~~~~~~~ Close the recordset ~~~~~~~~~~
Call closeConnection(adoRecordset)
End If
'~~~~~~~~~~ Close the database connection ~~~~~~~~~~
Call closeConnection(adoConnection)
Exit Function
ErrHandler:
If Err.Number <> 0 Then MsgBox Err.Description
Exit Function
End Function
[\code]
When I try to receive the recordset from the object in my form I'm getting an error that is basically letting me know that I'm not using the correct syntax. This is what I have in my form to access the recordset from the COM object:
[code]
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim objClients As TimeCard.IClient
Set objClients = New TimeCard.CClient
Set rs = objClients.getClients
Do Until rs.EOF
cmbClients.AddItem rs!client_Name
cmbClients.ItemData(cmbClients.NewIndex) = rs!client_UID
rs.MoveNext
Loop
End Sub
[\code]
This is wrong, I know, but I'm having trouble finding helpful documentation that explains how to do it correctly. If anyone can offer some assistance here, it would be greatly appreciated. A pathetically easy problem for the average pro to figure out, but a showstopper for a rookie such as myself.
Thanks,
- VB Rookie