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选项卡示例】Ac...(09.09)
- 【Access源码示例】按输入...(09.02)
- 【Access日期区间段查询】...(08.29)
- 【Access日期区间段查询】...(08.27)
- Access怎样才能实现日期时...(08.21)
- 【Access定时打开查询】A...(08.19)
- Access生成固定数量的记录...(08.13)
- Access怎样才能实现日期时...(08.12)
- Access利用导航窗体控件对...(08.03)
学习心得
最新文章
- Access表中的字段名、字段标题...(09.19)
- Access快速开发平台--更改“...(09.18)
- 【中秋及国庆优惠】Access培训...(09.15)
- Access如何将日期型的数值转换...(09.14)
- 英文输入法输入数据中存在单引号引起...(09.11)
- 【Access选项卡示例】Acce...(09.09)
- 让Access光标停留在指定的控件...(09.07)
- 关于Access查询条件里使用通配...(09.06)
- Access报表偷懒制作法--Ac...(09.05)
- Access快速开发平台--窗体数...(09.04)