mdb to accdb error

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

mdb to accdb error

Post by CData »

change frm mdb to accdb is triggering errors at

rs.FindFirst
rs.NoMatch

I go to re-write the line and don't find these in intellisense....

How does one navigate this?

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: mdb to accdb error

Post by HansV »

In the Visual Basic Editor, select Tools > References...
Make sure that the reference to the Microsoft Office n.0 Access database engine Object Library is ticked.
n depends on the version of Access:
12 for Access 2007
14 for Access 2010
15 for Access 2013
16 for Access 2016

If you also have a reference to the Microsoft ActiveX Data Objects m.n Library (where m.n can be several values), use the arrow buttons to move the reference to the Microsoft Office n.0 Access database engine Object Library to above that for Microsoft ActiveX Data Objects m.n Library.
Or declare rs explicitly as a DAO object:

Dim rs As DAO.Recordset
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: mdb to accdb error

Post by CData »

before I saw your post Hans I added the DAO. in the Dim for the rs

then also I saw the set was: Set rs = db.OpenRecordset("DictionaryUS", DB_OPEN_SNAPSHOT)
and I changed that to: Set rs = db.OpenRecordset("DictionaryUS", dbOpenSnapshot)

and this does seem to make everything work

after seeing your post I checked references and 15 is checked but I know that there is a mixed environment with PCs using 2007 and 2010 - and so not sure if multiple should be checked or if that is feasible....

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: mdb to accdb error

Post by HansV »

You're going to have a problem if you're using Access 2013 and other users have 2010 or 2007. It'd be best to develop the database in the oldest version that you need to support, i.e. in Access 2007.
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: mdb to accdb error

Post by CData »

yeah I'm not wanting to do things this way..... but in a mixed environment of 07, 10, 13...maybe 16.... which references should be checked in this case? plus I think the majority are 07 runtime and only a few are full licensed PCs....

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: mdb to accdb error

Post by HansV »

For DAO, you should set a reference to the Microsoft Office 12.0 Access database engine Object Library - that's the one for Access 2007. Later versions will recognize it automatically.
But if you run Access 2013, probably only the Microsoft Office 15.0 Access database engine Object Library reference will be available...
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: mdb to accdb error

Post by CData »

hmmmm well thanks Hans.... will have to see if an 07 pc has full license.....