Different report format (1 Viewer)

Sreemike

Registered User.
Local time
Today, 05:56
Joined
Jan 20, 2012
Messages
31
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?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:56
Joined
Sep 21, 2011
Messages
14,041
I would amend the report to put the client name no matter which client it is?
Advise the other clients it is an enhancement. :)

Otherwise test for that particular client, and only show and populate client name textbox if that client.?
 

Sreemike

Registered User.
Local time
Today, 05:56
Joined
Jan 20, 2012
Messages
31
I don’t want other’s report to display this guy’s company logo. I’m thinking somehow distinguishing his from others using a tick box in form entry.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:56
Joined
Sep 21, 2011
Messages
14,041
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?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:56
Joined
Feb 19, 2002
Messages
42,970
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
 

Sreemike

Registered User.
Local time
Today, 05:56
Joined
Jan 20, 2012
Messages
31
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.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 12:56
Joined
Sep 21, 2011
Messages
14,041
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.
I am going to stick my neck out and say No?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:56
Joined
Feb 19, 2002
Messages
42,970
Currently, all clients have the same headed report. Based on one particular client,
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.
 

Users who are viewing this thread

Top Bottom