K
Keith G Hicks
Using Access 2003 with A2k format
I'm trying somethign I haven't done before so I'm not sure if I'm on the
right track. I want to set the source of a report to an adodb command
object. Here's what I'm doing:
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With cmd
.ActiveConnection = cnnCurrProj
.CommandType = adCmdStoredProc
.CommandTimeout = 0
.CommandText = "sp_RptNoticeReceipt"
.Parameters.Refresh
.Parameters.Item("@bitOneNoticeOnly").Value = bolOneNoticeOnly
.Parameters.Item("@iNoticeID").Value = IIf(bolOneNoticeOnly,
lngCurrNoticeID, 0)
.Parameters.Item("@sAttyIDs").Value = strGetAttyIDs
.Parameters.Item("@dtStartDate").Value = dteStartDate
.Parameters.Item("@dtEndDate").Value = dteEndDate
.Prepared = True
End With
rs.Open cmd
Me.RecordSource = rs.Source
All the above code (in the report's on open event) runs fine (no errors) but
when the report actually tries to display it closes right away and I get the
error:
The record source "|" specified on this form or report does not exist.
What am I doing wrong?
Thanks,
Keith
I'm trying somethign I haven't done before so I'm not sure if I'm on the
right track. I want to set the source of a report to an adodb command
object. Here's what I'm doing:
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With cmd
.ActiveConnection = cnnCurrProj
.CommandType = adCmdStoredProc
.CommandTimeout = 0
.CommandText = "sp_RptNoticeReceipt"
.Parameters.Refresh
.Parameters.Item("@bitOneNoticeOnly").Value = bolOneNoticeOnly
.Parameters.Item("@iNoticeID").Value = IIf(bolOneNoticeOnly,
lngCurrNoticeID, 0)
.Parameters.Item("@sAttyIDs").Value = strGetAttyIDs
.Parameters.Item("@dtStartDate").Value = dteStartDate
.Parameters.Item("@dtEndDate").Value = dteEndDate
.Prepared = True
End With
rs.Open cmd
Me.RecordSource = rs.Source
All the above code (in the report's on open event) runs fine (no errors) but
when the report actually tries to display it closes right away and I get the
error:
The record source "|" specified on this form or report does not exist.
What am I doing wrong?
Thanks,
Keith