Too few parameters with openrecordset 
Author Message
 Too few parameters with openrecordset

I have a parameter query that is based on a value in an open
form. When I run the query through query open or in code with
docmd.openquery, it opens without error. However, when I
attempt to open the query through openrecordset in code, I get "too few parameters. Expected 1". I'm certain the set statement is OK and the problem is that the parameter is not being interpreted properly. The parameter is as follows:
=forms![qbfcreatebills]![billdate]
Does anyone know what I'm doing wrong?
Incidentally, I'm using the openrecordset method solely because the docmd method does not support transaction processing. Is there a way around this or am I forced to get the
openrecordset method right?
I'm Using Access 97.
Any help is greatly appreciated.

--

  --------------------------------------------------------------------
  Posted using Reference.COM                   http://www.*-*-*.com/
  FREE Usenet and Mailing list archive, directory and clipping service
  --------------------------------------------------------------------



Sun, 02 Jul 2000 03:00:00 GMT  
 Too few parameters with openrecordset

When you are using a parameter query and the parameter is a reference to a
control on a form this only has means something to Access, when you are
using the Query in code DAO has no idea about Access objects such as forms
and controls so the parameter is treated just like any other parameter and
has to be explicitly filled in.

See Dev Ashish's reply which shows how to explicitly fill parameters in
code.


Quote:
>I have a parameter query that is based on a value in an open
>form. When I run the query through query open or in code with
>docmd.openquery, it opens without error. However, when I
>attempt to open the query through openrecordset in code, I get "too few

parameters. Expected 1". I'm certain the set statement is OK and the problem
is that the parameter is not being interpreted properly. The parameter is as
follows:
Quote:
>=forms![qbfcreatebills]![billdate]
>Does anyone know what I'm doing wrong?
>Incidentally, I'm using the openrecordset method solely because the docmd

method does not support transaction processing. Is there a way around this
or am I forced to get the
Quote:
>openrecordset method right?
>I'm Using Access 97.
>Any help is greatly appreciated.

>--

>  --------------------------------------------------------------------
>  Posted using Reference.COM                  http://WWW.Reference.COM
>  FREE Usenet and Mailing list archive, directory and clipping service
>  --------------------------------------------------------------------



Mon, 03 Jul 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Too few parameters with qdf.OpenRecordset

2. OpenRecordset doesn't open (even with the right parameters)

3. OpenRecordset Parameter Problem

4. opening a defined parameter query using openrecordset method

5. How to pass parameter to OpenRecordset

6. Why does my QryDef.OpenRecordset want PARAMETERS?

7. VBA Query Executes Error Too Few Parameters

8. "Too Few Parameters"

9. Too few Parameters

10. too few parameters message

11. Too Few Parameters

12. Too few parameters. Expected 2

 

 
Powered by phpBB® Forum Software