Use recordset as form recordsource... with a twist
Hi Everybody
I've racked my brains on this for a few days off and on now so I'm turning to the forum of saviors for some much needed assistance...
I have a Client/Server app that I'm attempting to development using only ADO and parameter to send/retrieve recordsets that result from running Stored Procedures in SQL Server 2000. So far (with the much appreciated assistance of my man Java) I have had good results but I've hit a snag and I'm not sure what I'm doing wrong. I have a form with a listbox that, when the user selects a record from the list, code in the double-click event connects to the backend - passes the SubID(PK) from the selected record to a Stored Procedure which returns a recordset based on the parameter input. From here I am trying to bind this recordset to an unbound form and open the form (This is EXACTLY like having a form based on a query with a WHERE clause and passing data to the query and opening the form for that specific record)
However...
I am having problems as I keep getting an error telling me that I have a compile error and that there is an object required. The error highlights this line in the debug window:
I have a feeling that the recordset that is returned is not in the correct format but I'm not sure as to the format required... if anyone has a suggestion or a place to get more info I'd be most greatful...
Thanks,
Kev
Hi Everybody

I've racked my brains on this for a few days off and on now so I'm turning to the forum of saviors for some much needed assistance...
I have a Client/Server app that I'm attempting to development using only ADO and parameter to send/retrieve recordsets that result from running Stored Procedures in SQL Server 2000. So far (with the much appreciated assistance of my man Java) I have had good results but I've hit a snag and I'm not sure what I'm doing wrong. I have a form with a listbox that, when the user selects a record from the list, code in the double-click event connects to the backend - passes the SubID(PK) from the selected record to a Stored Procedure which returns a recordset based on the parameter input. From here I am trying to bind this recordset to an unbound form and open the form (This is EXACTLY like having a form based on a query with a WHERE clause and passing data to the query and opening the form for that specific record)
However...
I am having problems as I keep getting an error telling me that I have a compile error and that there is an object required. The error highlights this line in the debug window:
Here is the whole piece of code (minus the connection objects as these are stored in a module and called when required):Set strRecordset = rst
Public Sub OpenWIP(strData As String)
Dim objCmd As ADODB.Command
Dim rst As ADODB.Recordset
Dim strRecordset As String
Call EstablishConnection
Set objCmd = New ADODB.Command
objConn.CursorLocation = adUseClient
With objCmd
.ActiveConnection = objConn
.CommandText = "sproc_WIPMAIN"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("SubID", adVarChar, adParamInput, 8, strData)
Set rst = .Execute
Set rst.ActiveConnection = Nothing
Call ReleaseConnection
End With
If rst.RecordCount > 0 Then 'there are rows returned
Set strRecordset = rst
Forms!frmWIP.RecordSource = strRecordset
Else 'no rows
End If
Set rst = Nothing
End Sub
I have a feeling that the recordset that is returned is not in the correct format but I'm not sure as to the format required... if anyone has a suggestion or a place to get more info I'd be most greatful...
Thanks,
Kev