Database is a DAO object. By default, Access 2000 uses ADO. You've obviously
set a reference to Microsoft DAO 3.6 Object Library, or else the declaration
"Dim dbs As Database" would have raised an error, but when you did so, you
must not have unchecked the reference to Microsoft ActiveX Data Objects 2.1
Library (ADO)
When you have both references, you'll find that you'll need to
"disambiguate" certain declarations, because objects with the same names
exist in the 2 models. For example, to ensure that you get a DAO recordset,
you'll need to use Dim rst as DAO.Recordset (to guarantee an ADO recordset,
you'd use Dim rst As ADODB.Recordset)
The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Sunnyrain" <so******@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I am developing a program in Access 2000. I couldn't make OpenRecordset
method work right.
It's working when I opened a simple SQL query below in OpenRecordset.
....
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select * from ATest")
....
But when I tried to use the value of Text Box object in a SQL query's
criteria, it warned me "Run-time error '3061', Too few parameters.
Expected 4". The SQL query is as below:
Select * from ATest
Where Date >[Forms]![myForm].txtDate
Thanks for your time and help.