Discussion:
Run-time error 3061. Too Few Parameters. Expected 2.
(too old to reply)
Know39
2011-09-27 18:41:51 UTC
Permalink
The following is SQL code from a function that works fine in our
current database. After changing the data source to a new database
suddenly it throws the 3061 error.

The error occurs whether the Original line or the Test line was used.
I checked all spellings and are correct. The [Member Medical] is a
query.

Function getPlnCovDesc(EID As String)
Dim mEmplClassCode As String
Dim mBenPlan As String

Dim rst As DAO.Recordset
Dim mSQL As String


'ORIGINAL LINE:
mSQL = "Select * from [Member Medical] where EMPL_ID = '" & EID & "'"

'TEST LINE:
'mSQL = "Select EMPL_CLASS_CD, BEN_PLAN_CD from [Member Medical] where
EMPL_ID='096553'"

Set rst = db.OpenRecordset(mSQL) <-- 3061 Error. Too Few
Parameters. Expected 2.
Douglas J Steele
2011-09-28 21:38:00 UTC
Permalink
Are you positive those two fields exist in the table exactly as typed in
your SQL?

"Know39" wrote in message news:5c8377f2-aa4e-4b3d-8a02-***@i28g2000yqn.googlegroups.com...

The following is SQL code from a function that works fine in our
current database. After changing the data source to a new database
suddenly it throws the 3061 error.

The error occurs whether the Original line or the Test line was used.
I checked all spellings and are correct. The [Member Medical] is a
query.

Function getPlnCovDesc(EID As String)
Dim mEmplClassCode As String
Dim mBenPlan As String

Dim rst As DAO.Recordset
Dim mSQL As String


'ORIGINAL LINE:
mSQL = "Select * from [Member Medical] where EMPL_ID = '" & EID & "'"

'TEST LINE:
'mSQL = "Select EMPL_CLASS_CD, BEN_PLAN_CD from [Member Medical] where
EMPL_ID='096553'"

Set rst = db.OpenRecordset(mSQL) <-- 3061 Error. Too Few
Parameters. Expected 2.
Phil
2011-09-30 13:12:07 UTC
Permalink
Post by Douglas J Steele
Are you positive those two fields exist in the table exactly as typed in
your SQL?
The following is SQL code from a function that works fine in our
current database. After changing the data source to a new database
suddenly it throws the 3061 error.
The error occurs whether the Original line or the Test line was used.
I checked all spellings and are correct. The [Member Medical] is a
query.
Function getPlnCovDesc(EID As String)
Dim mEmplClassCode As String
Dim mBenPlan As String
Dim rst As DAO.Recordset
Dim mSQL As String
mSQL = "Select * from [Member Medical] where EMPL_ID = '" & EID & "'"
'mSQL = "Select EMPL_CLASS_CD, BEN_PLAN_CD from [Member Medical] where
EMPL_ID='096553'"
Set rst = db.OpenRecordset(mSQL) <-- 3061 Error. Too Few
Parameters. Expected 2.
Is EID numeric or text? Assuning it is numeric (ID's usually are), you don't
need the quotes mSQL = "Select * from [Member Medical] where EMPL_ID = " &
EID & ";"

Incidently, you will get more replies from a newsgroup like
comp.databases.ms_access

Phil

Loading...