Form Header Height Problem (1 Viewer)

llkhoutx

Registered User.
Local time
Yesterday, 18:05
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.
 

RichO

Registered Yoozer
Local time
Yesterday, 18:05
Joined
Jan 14, 2004
Messages
1,036
Why not just always have an existing header and use the height or visible properties from your code to resize it or hide it?
 

llkhoutx

Registered User.
Local time
Yesterday, 18:05
Joined
Feb 26, 2001
Messages
4,018
Because I have two hundred forms, I want to modify them programmatically.
 

DALeffler

Registered Perpetrator
Local time
Yesterday, 17:05
Joined
Dec 5, 2000
Messages
263
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,
 

llkhoutx

Registered User.
Local time
Yesterday, 18:05
Joined
Feb 26, 2001
Messages
4,018
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

Top Bottom