Access开发平台--登陆时如何自动引用DAO3.6方法
时 间:2017-02-15 10:19:48
作 者:杜超 ID:16058 城市:江阴
摘 要:经常遇到'Mid'函数未定义,DAO类型未定义等错误一般手动重新引用DAO3.6就可以解决问题了。那如何让平台自动引用呢,方法如下
正 文:
将以下代码复制替换到模块basRDPStartup中就行了
Option Compare Database Option Explicit Public Function ReAddRDPLibReference() On Error Resume Next Dim strMDE As String: strMDE = CurrentDb.Properties("MDE") On Error GoTo ErrorHandler If strMDE = "T" Then Exit Function Dim strLib As String Dim strDao As String #If Win64 Then strLib = CurrentProject.Path & "\RDPLib.x64.ucl" #Else strLib = CurrentProject.Path & "\RDPLib.x86.ucl" #End If If FolderExists("C:\Windows\SysWOW64") Then strDao = "C:\Program Files (x86)\Common Files\microsoft shared\DAO\dao360.dll" Else strDao = "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll" End If Dim ref As Reference For Each ref In Application.References On Error Resume Next Dim strRef As String: strRef = "" strRef = ref.FullPath On Error GoTo ErrorHandler If strRef Like "*\RDPLib*.ucl" Then Application.References.Remove ref ElseIf strRef Like "*DAO*" Then Debug.Print strRef Application.References.Remove ref End If Next Application.References.AddFromFile strLib Application.References.AddFromFile strDao ExitHere: Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & strLib, vbCritical, "Reference Error #" & Err End Function Function FileExists(ByVal strFile As String, Optional bFindFolders As Boolean) As Boolean Dim lngAttributes As Long lngAttributes = (vbReadOnly or vbHidden or vbSystem) If bFindFolders Then lngAttributes = (lngAttributes or vbDirectory) Else Do While Right$(strFile, 1) = "\" strFile = Left$(strFile, Len(strFile) - 1) Loop End If On Error Resume Next FileExists = (Len(Dir(strFile, lngAttributes)) > 0) End Function Function FolderExists(strPath As String) As Boolean On Error Resume Next FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory) End Function
Access快速开发平台QQ群 (群号:321554481) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access窗体导出PDF】...(04.08)
- 【Access窗体导出PDF】...(04.07)
- Access两种方式实现即时更...(03.01)
- Access隐藏与显示lacc...(01.12)
- 【Access高效办公】将每个...(12.23)
- Access21点游戏源代码(12.13)
- 【Access窗体导出Exce...(11.15)
- 【Access开发】Acces...(11.14)
- 通过Access宏录入数据到选...(11.10)
学习心得
最新文章
- 【Access表名称命名建议】将A...(04.20)
- Access学习笔记--用Acce...(04.19)
- 【Access重复项查询示例】将A...(04.17)
- Access快速开发平台企业版--...(04.16)
- 【Access模块示例】通过模块代...(04.15)
- Access查询里面分组合计功能添...(04.13)
- 【Access删除查询】删除数字最...(04.12)
- 显示文件夹中所有文件的修改时间(04.11)
- 铁路工程管理系统;铁路工程管理小程...(04.10)
- 【Access查询示例】怎么将两个...(04.09)