C
Crystal
I'm trying to set a query in code and then set it in a
recordset, so I can use the data. I have this:
Set qdef = db.CreateQueryDef("", _
"PARAMETERS dteStart DateTime, dteEnd
DateTime; " & _
" SELECT Sum(tblActivity.Good) AS
CoilUnitTotal" & _
" FROM tblActivity" & _
" WHERE (((tblActivity.WkKey)=4) AND
((tblActivity.ActDate) BETWEEN [dteStart] AND [dteEnd]))")
Set prmStart = qdef.Parameters!dteStart
Set prmEnd = qdef.Parameters!dteEnd
prmStart = WeekStart
prmEnd = WeekEnd
Set rstQuery = qdef.OpenRecordset()
MsgBox rstQuery!CoilUnitTotal
It doesn't work. It says: "Too few parameters. Expected
2"
I thought I gave it the two parameters. What am I doing
wrong?
Any help would be greatly appreciated,
Crystal
recordset, so I can use the data. I have this:
Set qdef = db.CreateQueryDef("", _
"PARAMETERS dteStart DateTime, dteEnd
DateTime; " & _
" SELECT Sum(tblActivity.Good) AS
CoilUnitTotal" & _
" FROM tblActivity" & _
" WHERE (((tblActivity.WkKey)=4) AND
((tblActivity.ActDate) BETWEEN [dteStart] AND [dteEnd]))")
Set prmStart = qdef.Parameters!dteStart
Set prmEnd = qdef.Parameters!dteEnd
prmStart = WeekStart
prmEnd = WeekEnd
Set rstQuery = qdef.OpenRecordset()
MsgBox rstQuery!CoilUnitTotal
It doesn't work. It says: "Too few parameters. Expected
2"
I thought I gave it the two parameters. What am I doing
wrong?
Any help would be greatly appreciated,
Crystal