K
Keith G Hicks
Anyone have any ideas how to set the HIDDEN property of db objects (all of
them - tables, queries, forms, reports, macros, modules) using CODE. So far
I have the following for forms but it doesn't actually change the property.
It runs fine, just doesn't do anything:
Dim db As Database
Set db = CurrentDb
Dim ctr As Container
Dim frm As Form
Dim doc As Document
Dim prp As Property
Dim bFoundProp As Boolean
bFoundProp = False
' Return referenct to Forms container.
Set ctr = db.Containers!Forms
' Enumerate through Documents collection of Forms container.
For Each doc In ctr.Documents
bFoundProp = False
Debug.Print doc.Name
doc.Properties.Refresh
For Each prp In doc.Properties
If prp.Name = "Hidden" Then
bFoundProp = True
Exit For
End If
Next prp
If bFoundProp = False Then
Set prp = doc.CreateProperty("Hidden", dbBoolean, False)
doc.Properties.Append prp
Debug.Print doc.Name, doc.Properties("Hidden")
End If
doc.Properties("Hidden") = False
Next doc
I'm sure I have to work "Attributes" in there somewhere, but the ms access
help on this topic sucks.
Thanks,
Keith
them - tables, queries, forms, reports, macros, modules) using CODE. So far
I have the following for forms but it doesn't actually change the property.
It runs fine, just doesn't do anything:
Dim db As Database
Set db = CurrentDb
Dim ctr As Container
Dim frm As Form
Dim doc As Document
Dim prp As Property
Dim bFoundProp As Boolean
bFoundProp = False
' Return referenct to Forms container.
Set ctr = db.Containers!Forms
' Enumerate through Documents collection of Forms container.
For Each doc In ctr.Documents
bFoundProp = False
Debug.Print doc.Name
doc.Properties.Refresh
For Each prp In doc.Properties
If prp.Name = "Hidden" Then
bFoundProp = True
Exit For
End If
Next prp
If bFoundProp = False Then
Set prp = doc.CreateProperty("Hidden", dbBoolean, False)
doc.Properties.Append prp
Debug.Print doc.Name, doc.Properties("Hidden")
End If
doc.Properties("Hidden") = False
Next doc
I'm sure I have to work "Attributes" in there somewhere, but the ms access
help on this topic sucks.
Thanks,
Keith