Access to the 2007 DAO Link Update

I am updating Access 97 DB / VBA code for Access 2007. VBA code uses DAO objects that reference Access 2007 when I converted the db files (first from 97 to 2002, and then to 2007). My problem is with two links: "Microsoft DAO 3.6 Object Library" and "Microsoft Database 12.0 Access Database Object Library". The material I read on the Internet says that ADE 12.0 should reassign the DAO 3.6 link, and that just checking the ADE 12.0 field should work. Since both of them provide links for objects with the same name, these two links cannot be checked at the same time. However, when you check the DAO 3.6 field and do not select the ADE 12.0 check box, Access cannot find the "frmLogin" form that exists. If I uncheck DAO 3.6 and check the ADE 12.0 field, I get a runtime error 13: "type mismatch" for the Visual Basic object "Err":

Public Function basGetString(ByVal lngStringID As Long, ParamArray varStringArgs() _ As Variant) As String Dim intTokenCount As Integer Dim strResString As String On Error GoTo err_basGetString strResString = basLoadString(lngStringID) If Not IsMissing(varStringArgs) Then intTokenCount = 0 Do While intTokenCount <= UBound(varStringArgs) strResString = basReplaceToken(strResString, _ m_cstrArgToken, varStringArgs (LBound(varStringArgs) + intTokenCount),_ 1, 1) intTokenCount = intTokenCount + 1 Loop End If strResString = basReplaceToken(strResString, m_cstrVBCRLFToken, vbCrLf, -1, 1) basGetString = strResString exit_basGetString: Exit Function err_basGetString: Err.Raise Err.Number, "basGetString", Err.Description End Function 

The debugger indicates the second line:

 Err.Raise Err.Number, "basGetString", Err.Description 

I successfully deleted the record objects that resolved many other link conflicts in the code: Dim rs As DAO.Recordset or Dim rs As ADODB.Recordset , but this did not work with the Err object. -That is, I tried to rewrite the Err object as a DAO Error object. I also could not find another link in the VB editor that resolves this link error, but also does not contradict another ADE 12.0 link. Therefore, I do not understand why checking the ADE 12.0 block does not solve all my problems. And it's hard for me to understand how to rewrite the code so that instead it refers to the ADE 12.0 library. Finally, the ADE 12.0 link does point to ACEDAO.DLL in the following folder: C: \ Program Files \ Common Files \ Microsoft Shared \ OFFICE12. Any suggestions would be really appreciated.

+4
source share
1 answer

If you work in A2007, you need to use the ADE link (which is just the next version of the DAO - look at the name of the DLL if you do not believe it). If you still get compilation errors when this is checked, it means that it is either not registered (and you can register it manually using regsvr32) or you have another problem link. Please post your list of links. My bet is that they are somewhat unnecessary. In addition, if you are using multiple versions of Access, you must allow each of them to complete the registration (i.e. installation) before opening any files.

- David-U-Fenton Aug 5 at 10:13 p.m.

0
source

Source: https://habr.com/ru/post/1316452/


All Articles