Alterng a report header by code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all !
I have an application developed with MS Access 2003 that I have begun
deploying. Some of my customers would like to add their logo and some text to
the header of some key reports. My idea is to have them store their logo in
the application directory and name it logo.bmp, store their company name,
address and whatever text they would like to display in the header in some
table. Then I would programmatically add this data to the header.
The problem is that I have no clue about how to alter a header by code.
Can someone help me please?
Many thanks in advance.
 
Paste the function below into a standard module.
Then set the report's On Open property to:
=LoadLogo([imgLogo])
where "imgLogo" represents the name of the image control you placed on the
report to show this logo.

Public Function LoadLogo(img As Image)
'Purpose: Load the logo graphic into the image control on forms and
reports.
'Usage: In a form's Open event procedure: Call
LoadLogo(Me.imgLogo)
' In a lightweight report's On Open property:
=LoadLogo([imgLogo])
Dim strFile As String
strFile = CurrentProject.Path & "\logo.bmp"
If Dir(strFile) <> vbNullString Then
img.Picture = strFile
End If
End Function
 
Thanks Allen,
I am testing it and will let you know how it went.
Many thanks.

--
Jean-Marie


Allen Browne said:
Paste the function below into a standard module.
Then set the report's On Open property to:
=LoadLogo([imgLogo])
where "imgLogo" represents the name of the image control you placed on the
report to show this logo.

Public Function LoadLogo(img As Image)
'Purpose: Load the logo graphic into the image control on forms and
reports.
'Usage: In a form's Open event procedure: Call
LoadLogo(Me.imgLogo)
' In a lightweight report's On Open property:
=LoadLogo([imgLogo])
Dim strFile As String
strFile = CurrentProject.Path & "\logo.bmp"
If Dir(strFile) <> vbNullString Then
img.Picture = strFile
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jean-Marie said:
Hi all !
I have an application developed with MS Access 2003 that I have begun
deploying. Some of my customers would like to add their logo and some text
to
the header of some key reports. My idea is to have them store their logo
in
the application directory and name it logo.bmp, store their company name,
address and whatever text they would like to display in the header in some
table. Then I would programmatically add this data to the header.
The problem is that I have no clue about how to alter a header by code.
Can someone help me please?
Many thanks in advance.
 
Allen, it worked fine. Thanks again for your help
--
Jean-Marie

Allen Browne said:
Paste the function below into a standard module.
Then set the report's On Open property to:
=LoadLogo([imgLogo])
where "imgLogo" represents the name of the image control you placed on the
report to show this logo.

Public Function LoadLogo(img As Image)
'Purpose: Load the logo graphic into the image control on forms and
reports.
'Usage: In a form's Open event procedure: Call
LoadLogo(Me.imgLogo)
' In a lightweight report's On Open property:
=LoadLogo([imgLogo])
Dim strFile As String
strFile = CurrentProject.Path & "\logo.bmp"
If Dir(strFile) <> vbNullString Then
img.Picture = strFile
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jean-Marie said:
Hi all !
I have an application developed with MS Access 2003 that I have begun
deploying. Some of my customers would like to add their logo and some text
to
the header of some key reports. My idea is to have them store their logo
in
the application directory and name it logo.bmp, store their company name,
address and whatever text they would like to display in the header in some
table. Then I would programmatically add this data to the header.
The problem is that I have no clue about how to alter a header by code.
Can someone help me please?
Many thanks in advance.
 
Back
Top