Solved

Report label in footer section

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
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…

763 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