klynch0803
Registered User.
- Local time
- Today, 15:53
- Joined
- Jan 25, 2008
- Messages
- 102
I have an error in this code which is error 3061 "To Few Paremater Expected 2"
I have a table "tdatInventoryRec" which has two fields "recdate" and "Cost"
On my form I have Fields "Weekstart" "WeekEnd" "GrossPurchase"
I'm trying to get this code to gather all records in table "tdatInventoryRec" that are between the "WeekStart" and the "WeekEnd" dates and sum the "Cost" and insert that value on the form in field "GrossPurchase"
Any idea what is wrong? I have checkied field names etc and cant find anything incorrect..
I have a table "tdatInventoryRec" which has two fields "recdate" and "Cost"
On my form I have Fields "Weekstart" "WeekEnd" "GrossPurchase"
I'm trying to get this code to gather all records in table "tdatInventoryRec" that are between the "WeekStart" and the "WeekEnd" dates and sum the "Cost" and insert that value on the form in field "GrossPurchase"
Any idea what is wrong? I have checkied field names etc and cant find anything incorrect..
Code:
Private Sub WeekEnd_AfterUpdate()
'<----------- Test----------->
Dim dbs As DAO.Database
Dim rstPurchase As DAO.Recordset
Set dbs = CurrentDb
Set rstPurchase = dbs.OpenRecordset("SELECT SUM(Cost) AS Purchase FROM tdatInventoryRec WHERE RecDate BETWEEN fdatPayEmp!WeekStart AND fdatPayEmp!WeekEnd")
Purchase = GrossPurchase.Value
'<----------End Test--------->
End Sub