M
michael c
I have a module on my form that sends emails. The code
gets caught up at "Set rs = db.Open..." and the error
is "Runtime Error 3061. Too Few Parameters. Expected 8."
I'm not really sure why I have to define parameters or how
to do so. The code works fine for other queries. Any
thoughts would be great. Thanks!!
If Me.Clock = Me!SENDENDOEAST Then
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * " & _
"FROM [qryManagement]" & _
"WHERE [Product]='Cola'")
LBDValue = rs![LBDDollarsShipped]
MTDValue = rs![MTDDollarsShipped]
QTDValue = rs![QTDDollarsShipped]
MTDValuePlan = rs![MTDPlan]
QTDValuePlan = rs![QTDPlan]
MTDPercPlan = (MTDValue / MTDValuePlan) -
Me!PercentOfMonth
QTDPercPlan = (QTDValue / QTDValuePlan) -
Me!PercentOfQuarter
DaysOfMonth = Me!CurrentDay & " of " & Me!DaysThisMonth
DaysOfQuarter = Me!QuarterWorkDaysToDate & " of " & Me!
QuarterWorkingDays
LBDText = "LBD:" & Format(Val(Str([LBDValue])), "#,###")
MTDText = "MTD:" & Format(Val(Str([MTDValue])), "#,###")
& "(" & Format(Val([MTDPercPlan]) * 100, "##.0\%") & ")"
QTDText = "QTD:" & Format(Val(Str([QTDValue])), "#,###")
& "(" & Format(Val([QTDPercPlan]) * 100, "##.0\%") & ")"
Msg = LBDText & vbCrLf & MTDText & vbCrLf & QTDText
....
End If
gets caught up at "Set rs = db.Open..." and the error
is "Runtime Error 3061. Too Few Parameters. Expected 8."
I'm not really sure why I have to define parameters or how
to do so. The code works fine for other queries. Any
thoughts would be great. Thanks!!
If Me.Clock = Me!SENDENDOEAST Then
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * " & _
"FROM [qryManagement]" & _
"WHERE [Product]='Cola'")
LBDValue = rs![LBDDollarsShipped]
MTDValue = rs![MTDDollarsShipped]
QTDValue = rs![QTDDollarsShipped]
MTDValuePlan = rs![MTDPlan]
QTDValuePlan = rs![QTDPlan]
MTDPercPlan = (MTDValue / MTDValuePlan) -
Me!PercentOfMonth
QTDPercPlan = (QTDValue / QTDValuePlan) -
Me!PercentOfQuarter
DaysOfMonth = Me!CurrentDay & " of " & Me!DaysThisMonth
DaysOfQuarter = Me!QuarterWorkDaysToDate & " of " & Me!
QuarterWorkingDays
LBDText = "LBD:" & Format(Val(Str([LBDValue])), "#,###")
MTDText = "MTD:" & Format(Val(Str([MTDValue])), "#,###")
& "(" & Format(Val([MTDPercPlan]) * 100, "##.0\%") & ")"
QTDText = "QTD:" & Format(Val(Str([QTDValue])), "#,###")
& "(" & Format(Val([QTDPercPlan]) * 100, "##.0\%") & ")"
Msg = LBDText & vbCrLf & MTDText & vbCrLf & QTDText
....
End If