P
perky2go
I'm getting a run-time error '3061' (too few parameters) and don't understand
why. Error occurs on the "Set R = D.OpenRecordSet(SQLText) line of the
function.
I'm opening a report from a form and trying to use code to replace tokens on
the report with field values from the form.
From the form "frmLetter" cmd button click event: DoCmd.OpenReport
"LtrRefund", acViewPreview
From the report "LtrRefund" OnOpen event: =filloutfrommap("ltrRefund")
Calls function on frmLetter class module:
Function FillOutFromMap(LetterName)
(in table "zLetterMap" the field "ltrName" contains the value "ltrRefund")
Dim F As Form, D As Database, R As Recordset, C As Control, SQLText As String
Set F = Forms![frmLetter]
Set C = Reports![ltrRefund]!lblAddr
Set D = DBEngine.Workspaces(0).Databases(0)
SQLText = "Select * from [zLetterMap] where [ltrname] = " & LetterName &
";"
Set R = D.OpenRecordset(SQLText)
Do Until R.EOF
C.Caption = Replace(C.Caption, R![Token], F(R![replacement]))
R.MoveNext
Loop
End Function
Seems to me I'm passing in the LetterName value of "ltrRefund", so why am I
"missing a parameter"?
Thanks!
why. Error occurs on the "Set R = D.OpenRecordSet(SQLText) line of the
function.
I'm opening a report from a form and trying to use code to replace tokens on
the report with field values from the form.
From the form "frmLetter" cmd button click event: DoCmd.OpenReport
"LtrRefund", acViewPreview
From the report "LtrRefund" OnOpen event: =filloutfrommap("ltrRefund")
Calls function on frmLetter class module:
Function FillOutFromMap(LetterName)
(in table "zLetterMap" the field "ltrName" contains the value "ltrRefund")
Dim F As Form, D As Database, R As Recordset, C As Control, SQLText As String
Set F = Forms![frmLetter]
Set C = Reports![ltrRefund]!lblAddr
Set D = DBEngine.Workspaces(0).Databases(0)
SQLText = "Select * from [zLetterMap] where [ltrname] = " & LetterName &
";"
Set R = D.OpenRecordset(SQLText)
Do Until R.EOF
C.Caption = Replace(C.Caption, R![Token], F(R![replacement]))
R.MoveNext
Loop
End Function
Seems to me I'm passing in the LetterName value of "ltrRefund", so why am I
"missing a parameter"?
Thanks!