كود لاخفاء الجداول والاستعلامات
كلمة السر 123
Dim db As Database
Dim obj As AccessObject, dbs As Object
Dim tdf As TableDef
Dim qry As QueryDefs
Set dbs = Application.CurrentData
Set db = CurrentDb
For Each obj In dbs.AllTables
Set tdf = db.TableDefs(obj.NAME)
If left(tdf.NAME, 4) <> "msys" And tdf.Attributes <> 1073741824 Then
tdf.Attributes = tdf.Attributes + dbHiddenObject
End If
Next
For Each obj In dbs.AllQueries
SetHiddenAttribute acQuery, obj.NAME, True
Next obj
Application.SetOption "Show Hidden Objects", 0
Application.SetOption "Show System Objects", 0
Set tdf = Nothing
db.Close
Set db = Nothing
وهذا اظهار الاستعلامات
Retry:
TimerId = SetTimer(0, 0, 1, AddressOf TimerProc)
Dim MyPassword As String
str_Title = "كلمة السر مطلوبه"
str_Prompt = "أدخـل كـلـمـة الـسـر لاظهار الجداول والاستعلامات"
MyPassword = InputBox(str_Prompt, str_Title)
Select Case MyPassword
Case "123"
Beep
MsgBox "الأن... يـمكـنـك اظهار الجدالول", vbOKOnly + vbInformation
Case Else
Beep
If MsgBox(" عــفــوا .. كــلــمــة الــســر خــاطــئــة " & vbCrLf & " مــن حــســن إســـلام الـمــرء تــركــه مــا لا يــعــنــيــه ", vbInformation + vbRetryCancel) = vbRetry Then GoTo Retry
Exit Sub
MsgBox "تم الرجوع", vbInformation, "إلغاء العملية"
End Select
Dim db As Database
Dim obj As AccessObject, dbs As Object
Dim qry As QueryDefs
Set dbs = Application.CurrentData
Set db = CurrentDb
For Each obj In dbs.AllQueries
SetHiddenAttribute acQuery, obj.NAME, False
Next obj
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If left(tdf.NAME, 4) <> "msys" And tdf.Attributes <> 1073741824 _
And tdf.Attributes = 1 Then
tdf.Attributes = tdf.Attributes - dbHiddenObject
End If
Next tdf
Set dbs = Nothing
db.Close
Set db = Nothing