
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
> --------------------------------------------------------------------