200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 恢复从 Access 2000 Access 2002 或 Access 中数据库删除

恢复从 Access 2000 Access 2002 或 Access 中数据库删除

时间:2022-10-22 05:13:52

相关推荐

恢复从 Access 2000  Access 2002 或 Access  中数据库删除

数据库|mysql教程

恢复从,Access,2000Access,20

数据库-mysql教程

单页团购源码,vscode图标css坏掉,ubuntu替换源,tomcat启动瞬间停止,爬虫AOP,php 价格计算,seo快排软件快照,公司网站源码手机,discuz二次元手机模板lzw

恢复从 Access 2000、 Access 2002 或 Access 中数据库删除表的方法

微驾校源码,ubuntu 录屏录音,一个tomcat多个工程,教师学苑 爬虫,php不能访问文件夹,uc 搜索seolzw

html5简单网页源码,ubuntu18解压,做爬虫被淘汰,php定义类一定要在文件开头吗,seo类型标题lzw

注意 : 本文示例代码使用 Microsoft 数据访问对象。 为此代码才能正常运行, 您必须引用 Microsoft DAO 3.6 对象库。 可以进行, 单击 工具 菜单中 VisualBasic 编辑器, 上 引用 并确保选中 Microsoft DAO 3.6 对象库 复选框。

1. 在 MicrosoftAccess 中打开数据库。

2. 在数据库窗口, 单击下 对象 , 模块 , 然后单击 新建 。

3. 键入或粘贴以下代码, 您只有创建模块中:

代码如下:

Function RecoverDeletedTable()

On Error GoTo ExitHere

‘*Declarations*

Dim db As DAO.Database

Dim strTableName As String

Dim strSQL As String

Dim intCount As Integer

Dim blnRestored As Boolean

‘*Init*

Set db = CurrentDb()

‘*Procedure*

For intCount = 0 To db.TableDefs.Count – 1

strTableName = db.TableDefs(intCount).Name

If Left(strTableName, 4) = “~tmp” Then

strSQL = “SELECT DISTINCTROW [” & strTableName & “].* INTO ” & Mid(strTableName, 5) & ” FROM [” & strTableName & “];”

DoCmd.SetWarnings False

DoCmd.RunSQL strSQL

MsgBox “A deleted table has been restored, using the name ‘” & Mid(strTableName, 5) & “‘”, vbOKOnly, “Restored”

blnRestored = True

End If

Next intCount

If blnRestored = False Then

MsgBox “No recoverable tables found”, vbOKOnly

End If

‘*EXIT/ERROR*

ExitHere:

DoCmd.SetWarnings True

Set db = Nothing

Exit Function

ErrorHandler:

MsgBox Err.Description

Resume ExitHere

End Function

4. 在 调试 菜单上, 单击 编译 数据库名称 数据库名称 。

5. 保存为 RecoverTable 模块。 要测试此函数, 首先创建两个表, 添加行, 并删除这两个表。

6. 在即时窗口, 键入以下行, 然后按 ENTER 键:

RecoverDeletedTable

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。