By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,962 Members | 1,889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,962 IT Pros & Developers. It's quick & easy.

Access 2007 upgrade DAO references conflict

P: 2
I am updating an Access 97 DB w/ VBA code to Access 2007. The VBA code uses DAO objects that Access 2007 references when I converted the db files (first from 97 to 2002, then to 2007). My problem specifically is with the two references: "Microsoft DAO 3.6 Object Library" and "Microsoft Office 12.0 Access database engine Object Library." The stuff I've read on the web says that the ADE 12.0 is supposed to supercede the DAO 3.6 reference, and that by just checking the ADE 12.0 box everything should work. Since they both provide references for objects of the same name, these two references cannot be checked at the same time. However, when check the DAO 3.6 box, and leave the ADE 12.0 box unchecked, Access can't find a "frmLogin" form that exists. If I uncheck the DAO 3.6 box and check the ADE 12.0 box, I get a run-time error 13: "type mismatch" for a Visual Basic "Err" object:

Expand|Select|Wrap|Line Numbers
  1. Public Function basGetString(ByVal lngStringID As Long, ParamArray varStringArgs() _ 
  2.       As Variant) As String 
  3.      Dim intTokenCount As Integer 
  4.      Dim strResString As String 
  5.  
  6. On Error GoTo err_basGetString 
  7.  
  8.     strResString = basLoadString(lngStringID) 
  9.  
  10.     If Not IsMissing(varStringArgs) Then 
  11.         intTokenCount = 0 
  12.  
  13.          Do While intTokenCount <= UBound(varStringArgs) 
  14.               strResString = basReplaceToken(strResString, _ 
  15.               m_cstrArgToken, varStringArgs (LBound(varStringArgs) + intTokenCount),_    
  16.               1, 1) 
  17.  
  18.               intTokenCount = intTokenCount + 1 
  19.          Loop 
  20.     End If 
  21.  
  22.     strResString = basReplaceToken(strResString, m_cstrVBCRLFToken, vbCrLf, -1, 1) 
  23.     basGetString = strResString 
  24.  
  25.  exit_basGetString: 
  26.       Exit Function 
  27.  err_basGetString: 
  28.       Err.Raise Err.Number, "basGetString", Err.Description 
  29.  
  30.  End Function

The debugger points the the second-to-last line:
Expand|Select|Wrap|Line Numbers
  1. Err.Raise Err.Number, "basGetString", Err.Description
I have been successful disambiguating recordset objects, which resolved many of the other referencing conflicts in the code: Dim rs As DAO.Recordset or Dim rs As ADODB.Recordset, but this hasn't worked with the Err object. -That is, I've tried to rewrite the Err object as a DAO Error object. I also have not been able to find another reference in the VB editor that resolves this referencing error, but doesn't also conflict with the other ADE 12.0 reference. So, I don't understand why checking the ADE 12.0 box doesn't solve all my problems. And I'm having trouble figuring out how to rewrite the code so that it references the ADE 12.0 library instead. Lastly, the ADE 12.0 reference is really pointing to the ACEDAO.DLL in the following folder: C:\Program Files\Common Files\Microsoft Shared\OFFICE12. Any suggestions would be really appreciated.
Jul 21 '10 #1
Share this Question
Share on Google+
3 Replies


100+
P: 255
How about changing err.raise to MsgBox?

Expand|Select|Wrap|Line Numbers
  1. MsgBox Err.Number & " " & Err.Description
Try and see if it gets error like this.
Jul 23 '10 #2

P: 2
@colintis
Thanks for the suggestion, Colintis. I tried your suggestion, but the type 13 message is still there. The only difference now is that it appears in a MsgBox, and not as a debugger error message. Back to the drawing board...
Aug 2 '10 #3

100+
P: 255
If so there is a variable defined in VBA is a different type to a field in the table. Do you extract field names in a sorted order that is the same to the ordering in the data table?

Or something similar, make a check. As what I had experienced, when converted from version 97 database, the ordering in the data fields may changed, this error is more obvious if you are getting data with the column index. Just make sure data types you are pointing to are fine. Access 2007 does a lot of funny things with a direct conversion on version 97 or older databases.
Aug 3 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.