Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

Error 3061 Too few parameters. Expected 1 from Access 97

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Richfield - 08 Nov 2004 20:11 GMT
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
Bas Cost Budde - 08 Nov 2004 21:14 GMT
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.
[quoted text clipped - 5 lines]
>         Set dbCurrent = CurrentDb()
>         Set qryEdits = dbCurrent.QueryDefs("qryEdits")

qryEdits.Parameters("lstLanguage")=[Forms]![frmDialog].[lstLanguage]

>         Set rsqryEdits = qryEdits.OpenRecordset
Saintor - 09 Nov 2004 02:31 GMT
"SELECT * FROM Edits WHERE Edits.Language='" &
[Forms]![frmDialog].[lstLanguage] & "';"

> 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
[quoted text clipped - 27 lines]
>
> Steve Richfield
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.