Subject: RE: Conditional Footers in a report 8/26/2008 12:43 PM PST
By: Klatuu
In: microsoft.public.access.reports
Following is the recommended solution to my original question on Conditional
Footers.
FSHOTT
7/9/2008 6:45 AM PST
Question
Can someone explain how I can create an expression (I assume and IIF())
that
will put a footer in a report if true and not put it in if false?
--
frank-a
It is not a matter of either putting a footer in or not putting a footer in a
report. That has to be done at design time. It is possible to open a report
in design view and manipulate the design using VBA, but I strongly advise
against it. If you encounter an error, you could corrupt your report. Also,
if you ever deliver and made or have any users that use the Runtime version
of
Access, it will not work.
The correct approach is to use the Formatevens of the footer and make the
footer either Visible or Not Visible.
--
Dave Hargis, Microsoft Access MVP
Resulting Solution which worked
You either have the code in the wrong event or you are trying to hid the
wrong section. The code is in a Group footer section. If you want to make
the group footer hidden, change it to:
Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupFooter3.Visible = Len(Nz(Me![Wire ID], vbNullString)) > 0
End Sub
If you are wanting to hide the report footer, move it the report
footer's format event.
can't speak for everyone..
Your Response to my Question
I tend to respond to postings that are
--clearly stated (what do you want to do, what is wrong with your attempt) I
hope I am more clearly stating my question and the problem I am desperately
trying to solve.
--well formatted (paragraphs and punctuation help)
--limited in scope (Design my database is out of scope, why does this query
return duplicates - possibly in scope)
--include the details needed to understand the problem (error numbers, error
messages, the SQL of the query)
--capable of being solved based on my knowledge. Unless I strongly believe
that what is being asked is impossible I will not respond with "it can't be
done", I will just ignore the post. There is almost always someone that does
know a way.
--that are not self-limiting. // I need to do this, but I don't want to use a
query or any VBA code//
In this particular case, you are referring to another post and a solution.
We
Don’t know what the solution is that you are using. Above I have copied in
my original question and the solution recommended.
Also, what is DZone (field type, field content)? A OZone (Origin) and DZone
(Destination) are Text fields which indicate the starting and ending position
of a wire in a vehicle. e.g. 2, 2a …..16 etc.
How are the records ordered in the report? Records are sorted on a few
criterias like HarnessNumber, WireType, Ozone and then DZone.
Is there a way to determine what the previous record is based on the content
of the current record? This is my big problem. I do not know how to do this.
Each record in my database is a wire with all of its characteristics (fields)
which go into several sub-assemblies which are identified as Harnesses.
Are you printing one record per page? I am reporting several records per a
page. Overall I have about 800 records per a report.
Which footer are you referring to (report footer, page footer, group
footer)? My problem and question are applicable to Group footers.
John Thank You for your response. Below I will try to provide more
information and clarification so you or someone else can hopefully help me.
I am producing a report of wires in a wiring harness which is for a vehicle.
The wires are grouped in the report based on a few criteria’s. The groups are
based on Harness Number, Wire Type, OriginZone (position) and
DestinationZone. The data types for all of these are text or single numbers.
What I would like to do is show or hide a group footer based on changes to
the above fields from one record to the next. Say I have 3 consecutive
records all with the OriginZone (e.g. 3.11) and have Group OriginZone Footer
which will show a “Green†line when the OriginZone changes (to say 3.12). I
also have a DestinationZone Group footer which produces say a “Red†line if
the DestinationZone changes from record to subsequent record. Currently I get
both a Green and Red line between the groups when the OriginZone changes.
What I would like to do is hide the “Red†line to retain only the Green line.