VBA OpenDatabase: Access 97 <-> Access 2000 
Author Message
 VBA OpenDatabase: Access 97 <-> Access 2000

Hello NG,

I want to open an MS Access database with VBA:

Private Sub cmdStart_Click()
Dim Dbs As Database
Dim Rst As Recordset

' Open Database
Set Dbs = OpenDatabase(App.Path & "\database1.mdb")
Set Rst = Dbs.OpenRecordset("Table1")

If the database is in access 97 format, everything works fine.
Now I converted the db to access2000 and the error 'Nicht erkennbares
Datenbankformat database1.mdb'  (= database format can not be identified)

How can I read an Access 2000 database ??

regards

Andreas Krause

--
note: remove '.nospam' from my eMail address in case of reply



Mon, 05 Apr 2004 18:09:39 GMT  
 VBA OpenDatabase: Access 97 <-> Access 2000
Andy,
This has to do with references.Check in the correct references.Also in
your code declare db as DAO.database and DAO.Recordset.
Rob
Quote:

> Hello NG,

> I want to open an MS Access database with VBA:

> Private Sub cmdStart_Click()
> Dim Dbs As Database
> Dim Rst As Recordset

> ' Open Database
> Set Dbs = OpenDatabase(App.Path & "\database1.mdb")
> Set Rst = Dbs.OpenRecordset("Table1")

> If the database is in access 97 format, everything works fine.
> Now I converted the db to access2000 and the error 'Nicht erkennbares
> Datenbankformat database1.mdb'  (= database format can not be identified)

> How can I read an Access 2000 database ??

> regards

> Andreas Krause



Mon, 05 Apr 2004 20:57:17 GMT  
 VBA OpenDatabase: Access 97 <-> Access 2000
A97 uses DAO Library (where the objects you used like Database, Recordset
reside).  A2K defaults to ADO Library in lieu of DAO.  Beware also that both
DAO & ADO have an object by the same name "Recordset" but DAO & ADO
Recordsets are not compatible.

Open any code module, then use the Menu Tools / References ...

1.  Select / check the box for DAO Library.

2.  Use the Priority Up / Down Arrow and move DAO so that it has higher
Priority than ADO.

3.  Better still, if you don't use ADO (if you don't know it, you don't use
it), remove / uncheck it from the References collection.

4.  Fully qualify these objects to make sure that Access doesn't default to
the wrong ones.  For example:

Dim Dbs As DAO.Database
Dim Rst As DAO.Recordset

Note: you don't need "DAO." with Database as ADO doesn't have Database  (ADO
uses Connection) but it is a good reminder for the "DAO." for Recordset
which is more important.

HTH
Van T. Dinh


Quote:
> Hello NG,

> I want to open an MS Access database with VBA:

> Private Sub cmdStart_Click()
> Dim Dbs As Database
> Dim Rst As Recordset

> ' Open Database
> Set Dbs = OpenDatabase(App.Path & "\database1.mdb")
> Set Rst = Dbs.OpenRecordset("Table1")

> If the database is in access 97 format, everything works fine.
> Now I converted the db to access2000 and the error 'Nicht erkennbares
> Datenbankformat database1.mdb'  (= database format can not be identified)

> How can I read an Access 2000 database ??

> regards

> Andreas Krause

> --
> note: remove '.nospam' from my eMail address in case of reply



Mon, 05 Apr 2004 22:58:44 GMT  
 VBA OpenDatabase: Access 97 <-> Access 2000
Hi !

Now it works ! :)
Thank you for your help.

regards

Andreas Krause



Tue, 06 Apr 2004 15:10:17 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. vba access 97 -> access 2000

2. Access 2000 VBA Handbook vis a vis Access 97 VBA Handbook

3. Access 97 -> Access 2000 VB Scope Problem

4. Access 97 ---> Access 2000 migration

5. access 97 -> access 2000

6. Access 97 VBA modifications not visible in Access 2000

7. Using VBA to Convert Access 2000 database to Access 97

8. Converting Access 97 to Access 2000 via VBA

9. Newbie in distress - Access 2000 <- 97, Workspaces

10. <<<<<<<<ComboBox>>>>>>>>>>>>

11. Access 97 upgrade to Access 2000 or Access 2002

12. ACCESS 97->2000: exclusive open??

 

 
Powered by phpBB® Forum Software