Form Header Height Problem

llkhoutx

Registered User.
Local time
Today, 07:15
Joined
Feb 26, 2001
Messages
4,018
How do I programmatically determine whetehr or not a form has a form header?

Using Forms(FormStringName).Section(acHeader) and Forms(FormStringName).Section(acHeader).Height causes various errors, depending on how I use them, when no form header exists.

Thank you in advance for your solutions.
 
Why not just always have an existing header and use the height or visible properties from your code to resize it or hide it?
 
Because I have two hundred forms, I want to modify them programmatically.
 
From "Access 97 Developer's Handbook", pg 527, 3rd Ed.:

"Access provides no simple way of determining whether a given section has been created on a form or report."

It then goes on to give a simple Function code listing that I've modified slightly below. If the attempt to return the height of the section by the function does not cause an error, the section must have existed.

Code:
Function IsSection(obj As Object, intSection As Integer) As Boolean
Dim intSecHeight As Integer
On Error Resume Next
intSecHeight = obj.Section(intSection).Height
IsSection = (Err.Number = 0)
End Function

Call the function by:

Debug.Print IsSection(Form/ReportReference, SectionNumber)

Exmple: Debug.Print IsSection(Me, acHeader)

hth,
 
Your solution appears to be a good trick. I'll give it a try.

I gave up on A97 because of the lack of the Conditional Format. I have 2 copies of Litwin's A97 Developer's Handbook (one for home and one for office). Both are in tatters from use.

Thank you.
 

Users who are viewing this thread

Back
Top Bottom