Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2007

Tip: Looking for answers? Try searching our database.

Determine if a Form has Header/Footer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sreedhar - 30 Jan 2007 06:32 GMT
Hi everybody,

How can I examine if a form has Header/Footer with code ?

Greatly appreciate any help.
Thank you.
Signature

Sreedhar

Douglas J. Steele - 30 Jan 2007 12:53 GMT
Try the following function:

Function HeaderExists(WhichForm As Form) As Boolean
On Error Resume Next

 HeaderExists = WhichForm.Section(acHeader).Visible
 If Err.Number = 2462 Then
   Err.Clear
 Else
   Err.Raise Err.Number, "HeaderExists", Err.Description
 End If

End Function

Inside a form, you'd call this as

 If HeaderExists(Me) Then
   MsgBox "This form has a visible header"
 Else
   MsgBox "This form does not have a visible header"
 End If

From a module, you can use HeaderExists(Forms!NameOfForm)

The form must be open for the function to work.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hi everybody,
>
> How can I examine if a form has Header/Footer with code ?
>
> Greatly appreciate any help.
> Thank you.
John Spencer - 30 Jan 2007 13:10 GMT
Using VBA function - the following code is not fully tested, but it should
give you the idea.

Public Function HasHeader(frmAny As Form) As Boolean
Dim TfAny As Boolean

  On Error GoTo HasHeader_Error
  TfAny = frmAny.Section(acHeader).Visible
  HasHeader = True

  Exit Function

HasHeader_Error:
  HasHeader = False 'Error 2462
End Function

Signature

John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

> Hi everybody,
>
> How can I examine if a form has Header/Footer with code ?
>
> Greatly appreciate any help.
> Thank you.
Sreedhar - 30 Jan 2007 14:41 GMT
Thanks Doug and Thanks John,

That works.

Signature

Sreedhar

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.