MS Access Report

PatAccess

Registered User.
Local time
Today, 15:27
Joined
May 24, 2017
Messages
284
Good day Smart people,

I have a report grouped by building which generates all equipment associated with that building. Right now, the report detail has an on-format event where:
if the Equipment type is A then show me 1a 2a 3a...
if the Equipment type is B then show me 1b 2b 3b...
But how do I make it where if the equipment type is C don't include a report for it all?

Hope you can understand what I'm asking


Thanks for the help
 
Exclude C type from the query that supports the report.?
 
OMG I was really thinking to hard. It was that simple. Thank you so much Gasman!
 
In your OnFormat event, you have two arguments - the Cancel and the FormatCount. You can try SOMETHING like this structure in your event code.

Code:
Private Sub Detail_Format( Cancel as Integer, FormatCount as Integer)

...
    Select Case [EquipType]
        Case "A"
            [I]do what you need to add the "a"[/I]
        Case "B"
            [I]do what you need to add the "b"[/I]
        Case "C"
            Cancel = -1
        Case Else
            [I]here you would handle unusual / unexpected cases[/I]
    End Select
...
End Sub

You at least IMPLY that you've got the A/B cases working, so you already know what to do to get your desired result.

OR you could use GasMan's solution of data exclusion via a WHERE clause in the data source. His solution might be easier but I answered your literal question.
 
Thank you The_Doc_Man, I've also tried the case which I also did not think about at first but I the cancel=1- is new to me so that you for that!
 
Yep, setting Cancel to -1 (technically, to TRUE) is the last-ditch "don't do this" signal. Since you weren't aware of using Cancel, please be aware that not all events supply a Cancel. Therefore, when dealing with event code, be aware that events "cascade" and if you want to Cancel a sequence, you need to catch it early.

For instance, on launching a form, you hit _Open, _Load, _Current, _Activate, _Enter events in sequence (I think I got the last two in the right order...) but only _Open supports a Cancel option.

Glad to have helped you learn a new trick.
 

Users who are viewing this thread

Back
Top Bottom