JimP said:
I would like to insert a company logo on a report. This is a multi-user app
such that the inclusion (or exclusion) of a logo and its path/file location
will not be known until runtime (can be passed from an open form). How can I
do this?
Here's the sample code for behind the reports Open Event.
' CorporateLogo is the name of the image control on the sub report
header.
Call CorpLogoOnReports(Me!CorporateLogo)
The following routine does the work. I used a hidden form called
Global Options which stores all these values. Watch for lots of word
wrap.
Sub CorpLogoOnReports(ctlCorpLogo As Control)
Dim PreviousPathandFileName As String
On Error GoTo tagError
If Not IsNull(Forms![Global Options]!jiClientLogoPathandFilename)
Or _
Len(Forms![Global Options]!jiClientLogoPathandFilename) <>
0 Then
ctlCorpLogo.Picture = Forms![Global
Options]!jiClientLogoPathandFilename
ElseIf Not IsNull(Forms![Global
Options]!poCorporateLogoPathandFilename) Or _
Len(Forms![Global Options]!poCorporateLogoPathandFilename)
<> 0 Then
ctlCorpLogo.Picture = Forms![Global
Options]!poCorporateLogoPathandFilename
End If
DoEvents
Exit Sub
tagError:
If Err.Number = 2220 Then 'Ignore file not found message
Else
MsgBox Err.Description
End If
Exit Sub
End Sub
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -
http://msmvps.com/blogs/access/