设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 324|回复: 3
打印 上一主题 下一主题

在Office2000里如何自动修复后台文件?

[复制链接]
跳转到指定楼层
1#
发表于 2003-4-1 18:25:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
下面有两个函数,但我都用不了,我试过引用dao3.5及dao3.6都无法使用下面两个函数,是什么原因?谁有其它代码可以修复后台数据库的?
我用了JRO,但它好象只能压缩而不能修复,是这样的吗?

这是小七的例子:
Function RepDB(strDBPathName As String)
On Error GoTo err_RepDB
dbengine.RepairDatabase strDBPathName
RepDB = "ass"
Exit Function
err_RepDB:
Select Case Err.Number
    Case 3356
        MsgBox Err.Description & vbLf & _
            "准备修复的数据库处于打开状态,请关闭所有操作后重试!"
    Case Else
        MsgBox Err.Description
End Select
RepDB = CVErr(65535)
End Function

这是KOMAZ的例子:
Function RepairDatabase(strSource As String, _
        strDestination As String) As Boolean
        ' Input values: the paths and file names of
        ' the source and destination files.

    ' Trap for errors.
    On Error GoTo error_handler

    ' Compact and repair the database. Use the return value of
    ' the CompactRepair method to determine if the file was
    ' successfully compacted.
    RepairDatabase = _
        Application.CompactRepair( _
        Logfile:=True, _
        Sourcefile:=strSource, _
        Destinationfile:=strDestination)

    ' Reset the error trap and exit the function.
    On Error GoTo 0
    Exit Function

' Return False if an error occurs.
error_handler:
    RepairDatabase = False

End Function

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
发表于 2003-4-1 18:35:00 | 只看该作者
在我的记忆中,ACCESS 2000 以后的版本中取消了修复功能,而且不能使用修复/压缩功能来对当前数据库进行操作。
3#
 楼主| 发表于 2003-4-1 18:38:00 | 只看该作者
那可就麻烦了,每次都要手动来修复。

点击这里给我发消息

4#
发表于 2003-4-1 18:47:00 | 只看该作者
可能 MS 认为当前电脑的供电情况越来越好的缘故吧,呵呵

不过我建议,既然用到后台数据库,何升级到MSDE呢?微软在MSDE的支持越来越好,而且当前的电脑设备也越来越好,更何况MSDE支持事务日志,安全性也更好,许可证协议与ACCESS JET类似,也能支持从WIN95到XP多种系统平台,多用户支持从5到25个。

罗嗦了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-9-21 14:50 , Processed in 0.100827 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表