can't figure out 3061 error = too few parameters

M

Marian M.

Error 3061 is keeping my module from running. The module is now an SQL with
two substitutions. I've made it simpler (took out nested loop) & still can't
see where the problem is. When I fill in the two 'blanks' and run it as a
query in Access, I get no error message. I've looked at the code until I'm
crosseyed but nothing pops out at me. I'm hoping that fresher pairs of eyes
will see the error(s) that I cannot.

Here is the 'simpler' module code:
----------
Sub CreateHLOffer()

Dim strFiceHLOffering As String, strSQL As String
Dim jLoop As Integer
Dim dbs As Database
Dim rsFiceHLOffering As Recordset

Set dbs = CurrentDb
For jLoop = 1 To 18
Set rsFiceHLOffering = dbs.OpenRecordset("Select FiceHLOffering From
tblHLOffering Where ID = " & jLoop)
strFiceHLOffering = rsFiceHLOffering!FiceHLOffering ' Set the first
Fice HLOffering string
strSQL = "UPDATE [LSAYCombinedCollegeVars-24Apr08-MLM] LEFT JOIN
[LSAYFice-CollLvl-25Apr08-MLM]"
strSQL = strSQL & " ON [LSAYCombinedCollegeVars-24Apr08-MLM].[r62a1]"
strSQL = strSQL & " = [LSAYFice-CollLvl-25Apr08-MLM].[UNITID]"
strSQL = strSQL & " SET
[LSAYCombinedCollegeVars-24Apr08-MLM].[hloffer61]"
strSQL = strSQL & " = [LSAYFice-CollLvl-25Apr08-MLM].[" &
strFiceHLOffering & "]"
strSQL = strSQL & " WHERE
(([LSAYCombinedCollegeVars-24Apr08-MLM].[r61])=" & jLoop & ");"
dbs.Execute strSQL
Next jLoop

End Sub
----------

Here is the query the should be created when jLoop = 11 (& that works just
fine as an Access query) (I just picked 11 at random for this example. It has
no special meaning)
----------
UPDATE [LSAYCombinedCollegeVars-24Apr08-MLM] LEFT JOIN
[LSAYFice-CollLvl-25Apr08-MLM] ON
[LSAYCombinedCollegeVars-24Apr08-MLM].[R62A1] =
[LSAYFice-CollLvl-25Apr08-MLM].[UNITID] SET
[LSAYCombinedCollegeVars-24Apr08-MLM].[hloffer61] =
[LSAYFice-CollLvl-25Apr08-MLM].[hloffer97_11]
WHERE (([LSAYCombinedCollegeVars-24Apr08-MLM].[r61])=11);
----------

Here is the error message:
----------
Too few parameters. Expected <number>. (Error 3061)

This parameter query requires the specified number of parameters, which you
did not supply. Provide the expected number of parameters, and run the query
again.

In some cases, this message is generated when unknown field names or
expressions are interpreted as query parameters. Be sure to enclose field
names containing spaces or punctuation with square brackets [ ].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top