我正在尝试压缩我的 Microsoft Access 2010 数据库。我正在使用 VS 2010。我似乎无法让压缩工作。我尝试了几种方法,但收到不同的错误消息。这是我现在拥有的代码。
Private Sub Compactdb()
Dim JRO As JRO.JetEngine
JRO = New JRO.JetEngine
'The first source is the original, the second is the compacted database under an other name.
JRO.CompactDatabase("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\C:\Forte\Fortedb.accdb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\C:\Forte\Compactdb.accdb")
'Original (not compacted database is deleted)
System.IO.File.Delete("C:\Program Files\VSoft\AppMiss\NewAppDB.mdb")
'Compacted database is renamed to the original databas's name.
Rename("C:\Forte\Compactdb.accdb", "C:\Forte\Fortedb.accdb")
'User notification
MsgBox("The database was compacted successfully")
End Sub
我现在得到的错误是
错误 1 无法将文件“\phipnasw01\users-hip$\cerns1\My Documents\Visual Studio 2010\Projects\Forte Data Gatherer\Forte Data Gatherer\Example1.accdb”复制到“bin\Debug\Example1.accdb”。找不到文件 '\phipnasw01\users-hip$\cerns1\My Documents\Visual Studio 2010\Projects\Forte Data Gatherer\Forte Data Gatherer\Example1.accdb'。Forte 数据收集器