Error 3061 - criteria

  • Thread starter Thread starter learning_codes
  • Start date Start date
L

learning_codes

Hi,

I don't understand I got the error. When I put criteria on crosstab
query,

Use:

Like "*baseball*". It run smooth without errors

[Forms]![Form1].[Cbo_sport].
The error I get is : Run-Time Error '3061'
Too few parameters_Expected 1

I would be much appreciated for ur help.

Thanks
 
With crosstab queries, it's always a good idea to explicitly declare the
parameter types.

Open the SQL view of the query, and put the following (including the
semi-colon at the end) in front of what's already there:

PARAMETERS [Forms]![Form1].[Cbo_sport] Text;
 
With crosstab queries, it's always a good idea to explicitly declare the
parameter types.

Open the SQL view of the query, and put the following (including the
semi-colon at the end) in front of what's already there:

PARAMETERS [Forms]![Form1].[Cbo_sport] Text;

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)






I don't understand I got the error.  When I put criteria on crosstab
query,

Like "*baseball*".    It run smooth without errors
[Forms]![Form1].[Cbo_sport].
The error I get is :    Run-Time Error '3061'
                              Too few parameters_Expected 1
I would be much appreciated for ur help.
Thanks- Hide quoted text -

- Show quoted text -

I still get the same errors. When I get the errors, the running code
stop at the line "Set CopyData_Query = db.OpenRecordset
(strQueryName)".

Is there a reason why i get the errors because of the line code?

thanks
 
It would definitely have helped to know that you were try to open a
recordset using the query!

OpenRecordset doesn't resolve parameters for you. You need to do something
like:

Dim dbCurr As DAO.Database
Dim qdfCurr As DAO.QueryDef
Dim prmCurr As DAO.Parameter
Dim CopyData_Query As DAO.Recordset

Set dbCurr = CurrentDb()
Set qdfCurr = dbCurr.QueryDefs("strQueryName")
For Each prmCurr In qdfCurr.Parameters
prmCurr.Value = Eval(prmCurr.Name)
Next prmCurr
Set CopyData_Query = qdfCurr.OpenRecordset

If that doesn't work, perhaps you should indicate what else your code
does...

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


With crosstab queries, it's always a good idea to explicitly declare the
parameter types.

Open the SQL view of the query, and put the following (including the
semi-colon at the end) in front of what's already there:

PARAMETERS [Forms]![Form1].[Cbo_sport] Text;

- Show quoted text -

I still get the same errors. When I get the errors, the running code
stop at the line "Set CopyData_Query = db.OpenRecordset
(strQueryName)".

Is there a reason why i get the errors because of the line code?

thanks
 
Back
Top