Does anyone know why Access 2000 cannot accept the line "dim .... as database" which was ok in access 97 and how to change it so can run in Access 2000 (with ADO ?).
thank's in advance
I believe, if you have both ADO and DAO references installed in your Access, you have to be specific when declaring your variables. For example, instead of
thank you for your reply, however I am still have some questions : is it just as simple as add word ADO in dim db as database. I have tried it but still cannot. I have tried the thread from Kathryn (of this forum) thanks Kathryn, as below :
Private Sub Command6_Click()
Dim dbs As Database
Dim strSQL As String
Dim qdf As QueryDef
Dim rst As Recordset
Dim qdfTemp As QueryDef
Set dbs = CurrentDb
strSQL = "SELECT TblJunction.ConID, TblCon.ConName, TblJunction.ProID, TblPro.ProName, TblCon.ConEmail FROM TblPro INNER JOIN (TblCon INNER JOIN TblJunction ON TblCon.ConID = TblJunction.ConID) ON TblPro.ProID = TblJunction.ProID WHERE (((TblJunction.ProID) = [ID]))ORDER BY TblJunction.ProID;"
Set qdf = dbs.CreateQueryDef("", strSQL)
Although ADO is the method for the future it can sometimes be ridiculous to upgrade legacy systems. All you really need to do to keep from having to upgrade to ADO is do a global search and replace for the following:
'As Database' Replace with 'As DAO.Database'
'As Recordset' Replace with 'As DAO.Database'
Then open a module in design view and set a reference to the Microsoft DAO 3.6 library. Magically your application will work perfectly. This is because the default for Access 97 is DAO and the default for Access 2000 is ADO but you can decide to be explicit as long as you reference the correct libraries.
Steve King Growth follows a healthy professional curiosity
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.