Solved

Report label in footer section

Posted on 2014-12-09
4
112 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
  • 2
  • 2
4 Comments
 
LVL 57

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 57
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now