
December 18th, 2007, 05:37 AM
|
|
Contributing User
|
|
Join Date: Apr 2005
Posts: 303
  
Time spent in forums: 1 Day 19 h 53 m 20 sec
Reputation Power: 8
|
|
|
Total values
I have a stored procedure that is executed on an access form. I want to be able to total the values up for the stored procedure on the form as o dont htink i can do it in the stored preocedure.
Stored precedure executed with these values:
AM times1: 2 PM times1: 0
AM times2: 1 PM times2: 5
Want field on for to show total for the above:
AM times: 3 PM times: 5
At the moment i only get the first value on the form as it is not totaling the second values. How can i do this. This is how i have executed the stored preocedure and displayed on my form.
Code:
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter
Dim rst As ADODB.Recordset
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = "DBO.sp_EngineerTimeslotsSchedule"
cmd.CommandType = adCmdStoredProc
Set prm = cmd.CreateParameter("STARTDATE", adDate, adParamInput, , txt_bookon)
cmd.Parameters.Append prm
Set prm = cmd.CreateParameter("CONTRACT", adVarChar, adParamInput, 3, txt_contract)
cmd.Parameters.Append prm
Set prm = cmd.CreateParameter("ENGINEER", adVarChar, adParamInput, 20, cbo_engineer)
cmd.Parameters.Append prm
Set rst = cmd.Execute()
If Not rst.EOF Then
txt_totalAM = rst.Fields("AMAppointments")
txt_totalPM = rst.Fields("PMAppointments")
End If
Set rst = Nothing
Set prm = Nothing
Set cmd = Nothing
Last edited by elenton : December 18th, 2007 at 05:45 AM.
|