I have a single database producing the same report template for different clients. But one of the clients now wants his company’s name displayed in the header section for his reports. How do I do this without affecting other’s report format?
I was not suggesting that Jeez
Just show what started as company name and is now logo?
So yes, have a field to indicate display logo, name, whatever you want. Hide the controls for these if not tequired?
I'm assuming that each client has his own separate BE with his data. Hopefully, there is something in that data that you can use to pull company name. If you want a logo also, you will need to have the client store the logo in the same folder as the BE with a specificly formatted name so you can find it.
Here's the code I use to decide if the report will show a logo since not all versions of the transmittal will. Your code will be different of course but it should give you an idea of how using a variable logo works and most importantly, WHERE the code goes -- The Format event of the ReportHeader section of each report.
Code:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
If Forms!frmCreateTransmittal!cboStageID.Column(2) = "Approval" Then
Me.txtExpectedReturnDT.Visible = True
Me.lblExpectedReturnDT.Visible = True
Else
Me.txtExpectedReturnDT.Visible = False
Me.lblExpectedReturnDT.Visible = False
End If
Debug.Print "Logo Path =" & Me.LogoPath & "="
If Me.LogoPath & "" = "" Then
Else
Me.imgLogo.Picture = Me.LogoPath
End If
End Sub
Hi, Thank you for the suggestion. Currently, all clients have the same headed report. Based on one particular client, I want a report with a different header format just for him. Is that possible without any VBA? Thanks.
Hi, Thank you for the suggestion. Currently, all clients have the same headed report. Based on one particular client, I want a report with a different header format just for him. Is that possible without any VBA? Thanks.
Did you not understand how the code I posted is variable? In my case, it only puts the logo on the form for a specific Transmittal type, but for that type of transmittal, the logo will reflect the actual company that is running the report.
If only one client wants a logo, then hard code the If statement to place a value in the control for ONLY that client. I think this is shortsighted but do what you want. In the long run, practicing defensive programming goes a long way toward making an application responsive to change requests from the client. Do NOT hard-code any data value without thinking long and hard about what it would take to make the code ALWAYS work instead.
There is hard-coding in my sample but it is of a database object name NOT some piece of data. If I add a new type of Transmittal, I might have to change the code to add the logo for that version of the report also but I'm already in there modifying the database to add functionality. If a new client is acquired or some existing client has the same idea about a logo, you would have no need to modify code if you used defensive programming. You would simply give them directions on where to put there logo and voila, the app works with no code change. It is no more difficult to make the logo option available for everyone than it is to make it work for only a single client. Do not limit yourself unnecessarily.