Solved

Report label in footer section

Posted on 2014-12-09
4
115 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

914 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

23 Experts available now in Live!

Get 1:1 Help Now