Saturday, January 16, 2010

Why I cann't attach my database in Access 2000 to the form using Dara Control in VB6?

In the book of VB6, examples are there to connect the sample databases supplied with the Access/VB using data control which works fine while I practice. But while trying to attach my own database created by Access 2000 by data control, it says ';Unrecognised database format';. How to get the connection?Why I cann't attach my database in Access 2000 to the form using Dara Control in VB6?
You'll need to use ADO to connect to an Access2000 mdb. There's an ADO control or you can do it in code. Here's smple code to get you started:





Dim Db as Connection


Dim SQLStatement as String





Set Db = New Connection


Db.CursorLocation = adUseClient


Db.Open gDSN


SQLStatement = ';Select ...';


Set adoSalesPerson = New Recordset


adoSalesPerson.Open SQLStatement, Db, adOpenStatic, adLockOptimistic


If adoSalesPerson.RecordCount %26gt; 0 ThenWhy I cann't attach my database in Access 2000 to the form using Dara Control in VB6?
I may be wrong, but from memory, youcan only use Access97 database with VB6, I heard of an update or patch for it to work with Access2000, or even using newer ODBC drivers, but never tried.

No comments:

Post a Comment