|
以下壇子裡高人共享的可以隱藏基本表的代碼,可不能隱藏查詢表,不知有沒有兄弟有隱藏查詢表的代碼分享一下,在此先謝謝了!
Function chediyincangbiao() '彻底隐蔽所有的表格包括链接表及系统表等
On Error GoTo Err_Command0_Click
Dim db As Database
Dim i As Integer
Set db = DBEngine.Workspaces(0).Databases(0)
db.TableDefs.Refresh
For i = 0 To db.TableDefs.Count - 1
'此项操作应避开系统表,以免将系统表属性改而造成问题.
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
CurrentDb.TableDefs(db.TableDefs(i).name).Attributes = 1
End If
Next i
Set db = Nothing
MsgBox "当前数据库中的所有表格都已被隐藏."
Exit_Command0_Click:
Exit Function
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Function
|
|