By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,770 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

Error 3061 Too few parameters. Expected 1 from Access 97

P: n/a
There have been LOTS of postings about error 3061, but mine seems to
be an even simpler case than the others. I have a simple
**FUNCTIONING** query called qryEdits. Copying the SQL from the query,
it reads:

SELECT Edits.Pattern, Edits.From, Edits.To
FROM Edits
WHERE (((Edits.Language)=[Forms]![frmDialog].[lstLanguage]));

The idea is to select just the language-appropriate records from the
Edits table. This works great when I run it alone. However when I try
to query this in DAO code, I get the Error 3061. My DAO code reads as
follows:

Dim dbCurrent As Database ' PFM
Dim qryEdits As QueryDef ' Where we keep qryEdits.
Dim rsqryEdits As Recordset ' The qryEdits recordset.

' lots of code in here

If Paragraphs& <> 0 Then ' Get the edits ready.
Set dbCurrent = CurrentDb()
Set qryEdits = dbCurrent.QueryDefs("qryEdits")
Set rsqryEdits = qryEdits.OpenRecordset

This last line is the one that gives me the 3061 error.

Thanks in advance for any thoughts, ideas, suggestions,
commizerations, castigations, curses, etc?

Steve Richfield
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The VBA environment cannot find the parameter--even if it sits right
there in a form. You have to pass it manually. I inserted a code line
that should do the trick, but I'm not sure about the notation of the
parameter name.
Dim dbCurrent As Database ' PFM
Dim qryEdits As QueryDef ' Where we keep qryEdits.
Dim rsqryEdits As Recordset ' The qryEdits recordset.

' lots of code in here

If Paragraphs& <> 0 Then ' Get the edits ready.
Set dbCurrent = CurrentDb()
Set qryEdits = dbCurrent.QueryDefs("qryEdits")
qryEdits.Parameters("lstLanguage")=[Forms]![frmDialog].[lstLanguage]
Set rsqryEdits = qryEdits.OpenRecordset

Nov 13 '05 #2

P: n/a
"SELECT * FROM Edits WHERE Edits.Language='" &
[Forms]![frmDialog].[lstLanguage] & "';"


"Steve Richfield" <go****@smart-life.net> wrote in message
news:78**************************@posting.google.c om...
There have been LOTS of postings about error 3061, but mine seems to
be an even simpler case than the others. I have a simple
**FUNCTIONING** query called qryEdits. Copying the SQL from the query,
it reads:

SELECT Edits.Pattern, Edits.From, Edits.To
FROM Edits
WHERE (((Edits.Language)=[Forms]![frmDialog].[lstLanguage]));

The idea is to select just the language-appropriate records from the
Edits table. This works great when I run it alone. However when I try
to query this in DAO code, I get the Error 3061. My DAO code reads as
follows:

Dim dbCurrent As Database ' PFM
Dim qryEdits As QueryDef ' Where we keep qryEdits.
Dim rsqryEdits As Recordset ' The qryEdits recordset.

' lots of code in here

If Paragraphs& <> 0 Then ' Get the edits ready.
Set dbCurrent = CurrentDb()
Set qryEdits = dbCurrent.QueryDefs("qryEdits")
Set rsqryEdits = qryEdits.OpenRecordset

This last line is the one that gives me the 3061 error.

Thanks in advance for any thoughts, ideas, suggestions,
commizerations, castigations, curses, etc?

Steve Richfield

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.