FindFirst error

  • Thread starter Thread starter Jerry C
  • Start date Start date
J

Jerry C

I have inherited a complex Access database designed by a
programmer who has since deceased. He was very good; I
am a novice. To make matters worse, his program was in
Access 97 and I've had problems migrating it up to Access
2002. So far, I've been able to work around most of the
errors, but one has me stumped.

In one of the private subs, there is a ".FindFirst" that
generates this error: Compile error: Method or data
member not found.

I think it might be solved in the References screen, but
I don't know how. Any ideas how I can get by this
error? Sorry I haven't given much detail, I don't fully
understand what he was up to, but I'll respond to any
inquiries for further details. I can post the entire
code section if necessary.

Thanks in advance.
 
From a code window, choose References on the Tools menu, and check the box
beside:
Microsoft DAO 3.6 Library
Since the database was originally in Access 97, you can probably uncheck the
box beside:
Microsoft ActiveX Data Objects 2.x

After than change, still in the code window, choose Compile from the Debug
menu. Hopefully the application will compile. For more information about
References, and what you need for each version of Access, see:
http://members.iinet.net.au/~allenbrowne/ser-38.html

You may also get some help from the new article:
Converting from Access 97 to 2000, 2002 or 2003
at:
http://members.iinet.net.au/~allenbrowne/ser-48.html
 
Jerry C said:
I have inherited a complex Access database designed by a
programmer who has since deceased. He was very good; I
am a novice. To make matters worse, his program was in
Access 97 and I've had problems migrating it up to Access
2002. So far, I've been able to work around most of the
errors, but one has me stumped.

In one of the private subs, there is a ".FindFirst" that
generates this error: Compile error: Method or data
member not found.

I think it might be solved in the References screen, but
I don't know how. Any ideas how I can get by this
error? Sorry I haven't given much detail, I don't fully
understand what he was up to, but I'll respond to any
inquiries for further details. I can post the entire
code section if necessary.

Thanks in advance.

This is just a shot in the dark, but I'm guessing that this is in a
procedure where the recordset object is declared something like this:

Dim rs As Recordset

That was fine in Access 97, when there was only one kind of Recordset
object, the DAO Recordset; but with Access 2000 and 2002 there are two
kinds, DAO recordsets and ADODB recordsets. At least, there are two if
you have both the DAO and ADO object libraries referenced. Both of
these libraries provide objects that can be used to manipulate database
data. DAO is more specialized to work with Access .mdb files, while ADO
is more general. Unfortunately, the two libraries define several
objects with the same names, which nevertheless don't have the same
properties and methods. The Recordset object is one of them. The DAO
Recordset object has a FindFirst method, while the ADODB Recordset
object has a Find method instead.

You can use both object libraries in the same Access application, but if
you do, you have to be careful to "disambiguate" all such common objects
by prefixing their names in the Dim statements with the library
qualifier DAO or ADODB, like this:

Dim rs As DAO.Recordset
Dim cn As ADODB.Connection

In your case, though, if you are just migrating an existing Access 97
application to Access 2002 and don't plan to write new code that uses
ADO, I suggest you simply drop the reference to ADO entirely. Here's
how to do it:

Press Alt+F11 to open the VB Editor. From the VB Editor's menu bar,
choose Tools -> References... I expect you'll see a reference with a
check mark next to it, that says "Microsoft ActiveX Data Object 2.x
Library" (the specific subversion may vary). Remove the check mark from
the check box beside that reference. While you're there, look for a
reference to "Microsoft DAO 3.6 Object Library". If it has a check mark
next to it, fine. If it doesn't have a check mark next to it, put one
there. Then click the OK button to close the dialog. That should take
care of your problem. Try compiling the project and see.
 
Back
Top