新建一个AC文件.
在一个新建的模块中加入以下代码,
运行这段代码,
注意,需要提供你要破解数据库的完整跟径及密码,无密码就输入一个空值.
Function XianshiBiao(strDBdirName As String, strDBPWD As String)
'可用于显示外部数据库的表
On Error Resume Next
Dim appAccess As Access.Application
Dim DB As Database
'OpenCurrentDatabase
Dim strDB As String
' 将字符串初始化为数据库的路径。
strDB = strDBdirName
' 创建 Microsoft Access 的实例。
Set appAccess = CreateObject("Access.Application")
' 在 Microsoft Access 窗口中打开数据库。
Set DB = appAccess.DBEngine.OpenDatabase(strDB, True, 0, ";PWD=")
appAccess.OpenCurrentDatabase strDB
'appAccess.Visible = True
'appAccess.DoCmd.OpenForm "切换"
'DB.CreateTableDef
'DB.Recordsets
Dim i As Integer
Dim str1 As String
DB.TableDefs.Refresh
For i = 0 To DB.TableDefs.count - 1
'CurrentDb.TableDefs(db.TableDefs(i).Name).Attributes = 1
'
str1 = DB.TableDefs(i).Name
'此项操作应避开系统表,以免将系统表属性改而造成问题.
If DB.TableDefs(i).Name = "msysaccessobjects" Or DB.TableDefs(i).Name = "MSYSACCESSXML" _
Or DB.TableDefs(i).Name = "MSYSACES" Or DB.TableDefs(i).Name = "MSYSOBJECTS" _
Or DB.TableDefs(i).Name = "MSYSQUERIES" Or DB.TableDefs(i).Name = "MSYSRELATIONSHIPS" Then
Else
Debug.Print str1
DB.TableDefs(i).Attributes = 0
If DB.TableDefs(i).Name = "tmpUsers" Then
'DB.TableDefs.Delete "用户表"
'docmd.CopyObject (,"用户表",acTable,)
'appAccess.Visible = True
'appAccess.DoCmd.OpenTable "用户表"
'appAccess.DoCmd.CopyObject , str1, acTable, str1
End If
End If
Next i
Set DB = Nothing
End Function