PC Review


Reply
Thread Tools Rate Thread

Run-time error 3061. Too Few Parameters. Expected 2.

 
 
Know39
Guest
Posts: n/a
 
      27th Sep 2011
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.
 
Reply With Quote
 
 
 
 
Douglas J Steele
Guest
Posts: n/a
 
      28th Sep 2011
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-(E-Mail Removed)...

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.

 
Reply With Quote
 
 
 
 
Phil
Guest
Posts: n/a
 
      30th Sep 2011
On 28/09/2011 22:38:03, "Douglas J Steele" wrote:
> 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-(E-Mail Removed)...
>
> 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.
>
>


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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error 3061 - Too few parameters. Expected 1 Marin Microsoft Access VBA Modules 5 27th Mar 2008 09:09 AM
Too few parameters. Expected 1 error. Sandy Microsoft Access Forms 1 29th Jul 2004 04:17 AM
Run-Time Error 3061...Too few parameters. Expected 2 Kimberly Microsoft Access Form Coding 1 6th May 2004 05:27 PM
Error 3061 (Too few parameters, Expected 1) ??? Alp Bekisoglu Microsoft Access Queries 2 26th Feb 2004 01:21 PM
Error opening recordset. Too few parameters. Expected 1. Reg Microsoft Access VBA Modules 2 8th Aug 2003 06:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:20 AM.