MS接入与系统时间设置的关系



我有MS Access数据库查询条件。。。文件。日期>日期((。。。它在一台计算机上运行良好,其中安装了FullAccess(2016(。但在我使用Access Runtime verison(也是2016(的其他版本中,它不起作用。

我已经在完整版本的计算机上用.accrd文件尝试过这个查询,它也能工作。是什么导致了这种行为?

这通常是由MISSING引用引起的。

您可以转到菜单"工具"、"引用",检查是否有引用标记为"丢失"并解决此问题。但是,由于它是一个运行时,您可能必须创建一个小型测试应用程序,该应用程序列出带有运行时的机器上的引用。这里有一个让你开始的模块:

Option Compare Database
Option Explicit
' Verify Access' external references.
' Returns True if all references are valid.
' Will run quietly, if called with parameter Quiet as True.
'
' Is intended to be called as the first command from the AutoExec macro
' followed by a call to a function - for example CompileAndSave - that will
' "compile and save all modules".
'
' 2018-07-10. Cactus Data ApS, CPH.
'
Public Function VerifyReferences( _
Optional ByVal Quiet As Boolean) _
As Boolean

' Settings for message box.
Const Title     As String = "Missing Support Files"
Const Header    As String = "One or more supporting files are missing:"
Const Footer    As String = "Report this to IT support." & vbCrLf & "Program execution cannot continue."
Const Buttons   As Long = VbMsgBoxStyle.vbCritical + VbMsgBoxStyle.vbOKOnly

Dim Reference   As Access.Reference

Dim Item        As Integer
Dim Guid        As String
Dim Major       As Long
Dim Minor       As Long
Dim Prompt      As String
Dim Broken      As Boolean
Dim SecondRun   As Boolean
Dim Result      As Boolean

Do
' Loop (a second time) the references and build a list of those broken.
Broken = False
Prompt = ""
For Each Reference In Access.References
If Reference.BuiltIn Then
' Nothing to check.
ElseIf IsBrokenExt(Reference) Then
Broken = True
Prompt = Prompt & Reference.Guid
On Error Resume Next
Prompt = Prompt & " - " & Reference.Name
On Error GoTo 0
Prompt = Prompt & vbCrLf
End If
Next

If SecondRun Then
' Only shuffle the references once.
Exit Do
ElseIf Not Broken Then
' All references have been verified.
Else
' Try to remove the last non-broken reference and add it back.
' This will shuffle the Reference collection and may or may not
' cause a broken reference to be added back.
Item = Access.References.Count
Do
Set Reference = Access.References.Item(Item)
If Not Reference.BuiltIn Then
If Not IsBrokenExt(Reference) Then
' Record the reference's identification before removal.
Guid = Reference.Guid
Major = Reference.Major
Minor = Reference.Minor
' Remove this reference.
Access.References.Remove Reference
' Add back the removed reference.
Access.References.AddFromGuid Guid, Major, Minor
Exit Do
End If
End If
Item = Item - 1
' Exit loop when a built-in reference is met.
' These are always the top ones.
Loop Until Reference.BuiltIn
SecondRun = True
End If
Loop Until Not Broken

Result = Not Broken

If Result = False And Quiet = False Then
Prompt = Header & vbCrLf & vbCrLf & Prompt & vbCrLf & Footer
VBA.MsgBox Prompt, Buttons, Title
End If

Set Reference = Nothing

VerifyReferences = Result

End Function
' Performs an extended check if a reference is broken, as the
' IsBroken property doesn't check for unregistered files. Thus,
' an unregistered reference may fail even if not marked MISSING.
'
' 2018-07-09. Gustav Brock. Cactus Data ApS.
'
Public Function IsBrokenExt( _
ByRef Reference As Access.Reference) _
As Boolean
Dim NotBroken   As Boolean

On Error GoTo Err_IsBrokenExt

' If the reference is not registered, calling property FullPath will fail.
' Even if the file exists in the Virtual File System, GetAttr will find it.
If (VBA.GetAttr(Reference.FullPath) And vbDirectory) <> vbDirectory Then
' FullPath is valid.
NotBroken = Not Reference.IsBroken
End If
Exit_IsBrokenExt:
IsBrokenExt = Not NotBroken
Exit Function

Err_IsBrokenExt:
' Ignore non-existing servers, drives, and paths.
Resume Exit_IsBrokenExt

End Function

最新更新