Fatal Error when displaying a control that Sums data

R

refrye

I have a database that is connected to Sql Server. On a couple of reports I
receive an Access Fatal Error when it displays the Control that displays the
Sum of one of the columns of the report (the last page of the report).
The Control's Control Source property is =Sum([Withdraw])

I build the Report's Recordsource on the Report's OnOpen Event(see Below)
Has anyone seen this before???


Private Sub Report_Open(Cancel As Integer)

Dim Cmd As ADODB.Command
Dim Prm As ADODB.Parameter
Dim Rs As ADODB.Recordset

Set Cmd = New ADODB.Command
Set Prm = New ADODB.Parameter
Set Rs = New ADODB.Recordset


With Cmd
.ActiveConnection = CurrentProject.Connection
.CommandType = adCmdStoredProc
.CommandText = "dbo.pr_BudgetsubBudgetLedgerRS"

Set Prm = Cmd.CreateParameter("@BudgetTypeKey", adTinyInt,
adParamInput, , Forms!frmbudgetmain!lstBudgetTypes)
.Parameters.Append Prm
Set Prm = Cmd.CreateParameter("@FY", adSmallInt, adParamInput, ,
Forms!frmbudgetmain!comboFy)
.Parameters.Append Prm
Set Prm = Cmd.CreateParameter("@Installation_Key", adTinyInt,
adParamInput, , Forms!frmbudgetmain!comboInstallation)
.Parameters.Append Prm
Set Prm = Cmd.CreateParameter("@Facility_Type", adChar,
adParamInput, 1, Forms!frmbudgetmain!ComboFacilityType)
.Parameters.Append Prm
Set Prm = Cmd.CreateParameter("@TransTypeKey", adTinyInt,
adParamInput, , Forms!frmbudgetmain!comboTransType)
.Parameters.Append Prm
Set Prm = Cmd.CreateParameter("@Account_Key", adTinyInt,
adParamInput, , Forms!frmbudgetmain!comboAccount)
.Parameters.Append Prm

End With


Rs.Open Cmd, , adOpenForwardOnly, adLockOptimistic
Set Me.Recordset = Rs

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top