Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Run-time error '3061': Too few parameters.Expected 2.

Posted on 2003-11-07
11
5,006 Views
Last Modified: 2007-12-19
this error apen at the last line of this code:

Public Function OpenFile(MyPath As String)

   Dim MyDatabase As Database
   Dim MyRecordSet1 As Recordset
   Dim MyRecordSet2 As Recordset
   Dim MyRecordSet3 As Recordset
   Dim MyRecordSet4 As Recordset
   Dim MyString As String
   
   Set MyDatabase = CurrentDb

   Set MyRecordSet1 = MyDatabase.OpenRecordset("Q_Export_File_1", dbOpenSnapshot)

The query by itself work find.

Thank's for your help
0
Comment
Question by:pmeloni
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 32

Accepted Solution

by:
jadedata earned 63 total points
ID: 9701507
Hey pmeloni!

  There is a field that cannot be resolved at command runtime in the query.
  copy the query as backup and then remove columns one-at-a-time until the error goes away
  The last column removed is the culprit.
 
  Posting the query would be a big help after you do the above.

regards
Jack
0
 

Author Comment

by:pmeloni
ID: 9701761
I change the query to the more simple possible:

SELECT [Cert Details].DetailID
FROM [Cert Details];

and I continue to have the message.

[Cert Details] is a table, not even a query.
0
 
LVL 17

Expert Comment

by:walterecook
ID: 9702032
pmeloni
When you changed to this:
SELECT [Cert Details].DetailID
FROM [Cert Details];
I understand that you still got the message but how many parameters is it looking for now?  2?  Or only 1?

Walt
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:pmeloni
ID: 9702240
2...
Surprising, there is just one field
0
 
LVL 17

Expert Comment

by:walterecook
ID: 9702328
Hmm
I'm curious to see if you changed the line to this, if it would open

Set MyRecordSet1 = MyDatabase.OpenRecordset("Cert Details", dbOpenSnapshot)

How about:
Set MyRecordSet1 = MyDatabase.OpenRecordset("Select * from [cert details]")

Walt
0
 
LVL 17

Expert Comment

by:walterecook
ID: 9702360
BTW
Which version of access are we in here?
DAO? ADO?
0
 

Author Comment

by:pmeloni
ID: 9702429
We are in Microsoft DAO3.6 Object Library

Using :
Set MyRecordSet1 = MyDatabase.OpenRecordset("Select * from [cert details]")
I get exactly the same error.

I'm using also as reference
Visual basic for application
Microsoft Access 11.0 Object library
Ole Automation
Microsoft calendar 11

I'm loosing my latin....

0
 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 62 total points
ID: 9702773
do you get the same when you open the table manually? If you sorted on a column in the table and "saved" the changes then change the column name you would get the error yuou are seeing, while in design mode of the table, right click and clear the Fiter and OrderBy properties of the table itself.

Steve
0
 
LVL 4

Expert Comment

by:inox
ID: 9703820

make sure to use the DAO objects by
 Dim MyRecordSet1 As DAO.Recordset in contrast to
 ADODB.Recordset

(I'm not very convinced about my own answer because you'd get a different message (type-error) in that case, so don't shoot me if it's nonsense)
0
 
LVL 39

Expert Comment

by:stevbe
ID: 10025021
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: jadedata {http:#9701507} & stevbe {http:#9702773}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question