Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Access ADP - Ado question: fill recordset and show

Author  Topic 

giovi2002
Starting Member

46 Posts

Posted - 2005-07-22 : 18:55:09
Workbench : access adp / sql server
script : Ado
Goal: Pass a value from a form (1) to a stored procedure (2) and retrieve and show the recordset within the application (3)
Status: 1 and 2 work with the written code, for number 3 'receive the recordset' I had to use a stupid workaround by having my SP to fill a table, after table is being filled my ado code will open a view based on this table. It would be more efficient to have my sp only to perform a parameterized query.

Can you extend my ado code?

I've used Dim rstKoppeltabel As ADODB.Recordset but don't know how to fill the recordset and display the results within the access adp

Private Sub SYSLIJNNUMMER_DblClick(Cancel As Integer)

On Error GoTo Err_Form_DblClick
Dim myado As ADODB.Command
Dim rec As Single
Dim StrBronrec As Variant 'parameter 1
Dim StrReprec As Variant 'parameter 2
Dim nmbSyslijnnummer As Variant 'parameter 3
Dim stDocName As String
Dim rstKoppeltabel As ADODB.Recordset 'recordset declaration
Set myado = New ADODB.Command
myado.ActiveConnection = CurrentProject.Connection
myado.CommandType = adCmdStoredProc
myado.CommandText = "dbo.Ap_Rapportagegegevens_Bronrecords"
StrBronrec = "%"
StrReprec = "%"
nmbSyslijnnummer = Me.SYSLIJNNUMMER
myado.Parameters.Append myado.CreateParameter("Bronrecord", adVariant, adParamInput, 12, StrBronrec)
myado.Parameters.Append myado.CreateParameter("Reprecord", adVariant, adParamInput, 12, StrReprec)
myado.Parameters.Append myado.CreateParameter("Syslijnnummer", adVariant, adParamInput, 12, nmbSyslijnnummer)
myado.Execute

DoCmd.OpenView "dbo.Vw_Koppeltabel_inzien", acViewPreview, acReadOnly
'this part opens the view and should be replaced by fill the recordset 'and display the results


Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
MsgBox Err.Description
Resume Exit_Form_DblClick

End Sub
   

- Advertisement -