Use Data control with Access 2000 databases
By: Microsoft Corporation Date: 03/12/1999

If, at design time, you try to bind a Data control to an Access 2000 database, through the DatabaseName property, you will get the error "Unrecognized database format".

However, you can still use the Data control. Follow these steps:

  1. From the Project menu, select References.
  2. Uncheck the checkbox next to Microsoft DAO 3.51 Object Library.
  3. Set a reference to the Microsoft DAO 3.6 Object Library.
  4. Click OK.
  5. Paste the following code into the Declarations section of the form with the Data control:
Option Explicit
Private daoDB36 As Database
Private rs As Recordset

Private Sub Form_Load()
    Set daoDB36 = DBEngine.OpenDatabase("filename.mdb")
   
Set rs = daoDB36.OpenRecordset("TableName")
   
Set Data1.Recordset = rs
End Sub

Remember to replace filename.mdb with path and name of the DB file, TableName with the name of the table to open, and Data1 with the name of the Data control.

Once you've done the above, you can work with bound controls as you always did before.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it