模块代码如下:
  Public Sub CompactJetDatabase(Location As String, Optional BackupOriginal As Boolean = True)'    On Error GoTo CompactErr    Dim strBackupFile As String    Dim strTempFile As String    Dim DBEngine As JRO.JetEngine    Set DBEngine = New JRO.JetEngine    '检查数据库文件是否存在    If Dir(Location) <> "" Then     ' 如果需要备份就执行备份     If BackupOriginal = True Then     strBackupFile = GetTemporaryPath(Location) & "backup.mdb"     If Dir(strBackupFile) <> "" Then Kill strBackupFile     FileCopy Location, strBackupFile     End If     ' 创建临时文件名     strTempFile = GetTemporaryPath(Location) & "temp.mdb"     If Dir(strTempFile) <> "" Then Kill strTempFile     '通过DBEngine 压缩数据库文件     DBEngine.CompactDatabase Location, strTempFile     ' 删除原来的数据库文件     Kill Location     ' 拷贝刚刚压缩过临时数据库文件至原来位置     FileCopy strTempFile, Location     ' 删除临时文件     Kill strTempFile'    Else    End If'CompactErr:'            Exit Sub    End Sub    Public Function GetTemporaryPath(str As String)    Dim strFolder As String
         
        strFolder = Left(str, 3)
        GetTemporaryPath = strFolder    End Function
窗体代码:
Private Sub Command1_Click()
     Call CompactJetDatabase("D:\a\vcd.mdb", True)
End Sub
错误提示为:初始化字符串不符合OLE DB规定