Solved

Report label in footer section

Posted on 2014-12-09
4
123 Views
Last Modified: 2014-12-09
Please see this screen shot...

report screen shot
"Variance Description Here" is a label.  

Where it reads "Variance Description Here " I want it to read "Record Change" IF there is "Previous Import" AND "New Import" in the detail section.

Where it reads "Variance Description Here " I want it to read "New Employee" IF there is "New Import" But no "Previous Import" in the detail section.

Where it reads "Variance Description Here " I want it to read "Removed Employee" IF there is "Previous Import" But no "New Import" in the detail section.

Make sense?  I expect I need code in the onprint event of the footer section but I don't know how to code it.

--Steve
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 40489183
Steve,

<<Make sense?  I expect I need code in the onprint event of the footer section but I don't know how to code it.>>

You want code in the OnFormat event.

1. Declare variables in the reports module for each of the possible things you want to track (i.e. bolPreviousImport, bolNewImport).

2. In the Groups header OnFormat event, do

   bolPreviousImport = False
   bolNewImport = False

3. In the OnPrint of the detail event:

   If <condition> then bolPreviousImport = True
   If <condition> then bolNewImport = True

4. and last, in the footers OnFormat event:

  Me.txtVarianceMessage = "no variance"

  If bolPreviousImport = True and bolNewImport = True then Me.txtVarianceMessage = "Record Change"
  If bolPreviousImport = False and bolNewImport = True then Me.txtVarianceMessage = "New Employee"
  If bolPreviousImport = True and bolNewImport = False then Me.txtVarianceMessage = "Removed Employee"

  That if logic could be structured a bit better, but it will work and get you started.

Jim.
0
 
LVL 58
ID: 40489186
Note on the group header; it's OK if you don't print anything.  You just need it to execute the code, so just make it visible and set its height to zero.

Jim.
0
 

Author Comment

by:SteveL13
ID: 40489231
The only thing I'm not sure of is what to put in the detail onprint section:

Option Compare Database

Dim bolPreviousImport, bolNewImport As String

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    If <condition> then bolPreviousImport = True
    If <condition> then bolNewImport = True
    
End Sub

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)

   Me.txtVarianceMessage = "no variance"

   If bolPreviousImport = True And bolNewImport = True Then Me.txtVarianceMessage = "Record Change"
   If bolPreviousImport = False And bolNewImport = True Then Me.txtVarianceMessage = "New Employee"
   If bolPreviousImport = True And bolNewImport = False Then Me.txtVarianceMessage = "Removed Employee"

End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)

    bolPreviousImport = False
    bolNewImport = False

End Sub

Private Sub Report_Close()

    DoCmd.Restore

End Sub

Open in new window

0
 

Author Closing Comment

by:SteveL13
ID: 40489237
I just got it.  Thank you once again.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question