Setting object to visible when using the OutputTo method

teambond

Registered User.
Local time
Today, 14:27
Joined
Jun 2, 2013
Messages
24
Hi,

I have a series of reports that are built to replicate the order forms of our suppliers. On each I have a text box for AirFreight that I only want visible when the airfreight ID is ticked.

I have this working fine using an if statement on the Load Event of the reports. However when I use the OutputTo command in VBA it seems to bypass the Load Event. Can anyone advise an event that is triggered using OutputTo.

I have also tried settting the .visible in VBA but can't get the coding to work as I am using a variable report name depending on the SupplierName and when I try to use the Reports! nomenclature it will not accept the Report name being a variable (ie. Reports!ReportName![Airfreight].Visible where ReportName is a variable).

Any advice would be greatly appreciated.

Thanks,
 
Code:
 Private Sub Report_Load()
    If Me.SupplierOrderType = 2 Then
        Me.AirFreight1.Visible = True
        Me.AirFreight2.Visible = True
    End If
End Sub

On the Load Event for the Report.
 
Where's the SupplierOrderType getting its value from? Is it bound to a field?
 
Yes, it's a bound control on the form.

This works fine if I run the report directly. It is only when I get vb to generate the report via the OutputTo function.
 
So what should happen if the SupplierOT is not 2? Your code doesn't cater for this.
And what section of the report did you place the two controls?
 
The code works fine. The things items are in Header and footer sections.

The issue is only on the OutputTo process.
 
Code doesn't work at all in the Open event (don't get that but anyway)

Have solved issue. I've put it in the On Print of both the header and footer sections and it works there.

Thanks.
 
It should work in the Open event, I've used it many a-times. If you upload a sample db I'll point to where the problem is.

You could have just used an IIF() function in the Control Source of both textboxes and set the Can Shrink propery to Yes.
 

Users who are viewing this thread

Back
Top Bottom