MarcieFess
Registered User.
- Local time
- Today, 12:19
- Joined
- Oct 25, 2012
- Messages
- 107
I have a report that is pretty complicated in the page numbering, since it's grouped by Aisle Number (it's a report of hazardous products in a store), and the Aisle Number and the "Page x of x" is in the header.
Someone here actually created all of the logic for me last year.
I'm trying to document everything, and I cannot for the LIFE of me figure out how a particular table is being populated with the information.
Here's the Event Procedure for the "On Open" event of the report:
ztblAislePages is a permanent table that holds temporary information...it's populated with information only for this report, and as you can see from the code above, it's cleared at the beginning of the process.
I cannot figure out where this information is coming from to populate the table, however.
The line
doesn't tell me where the information is coming from.
The table itself has no source data that I can find, unless I'm not looking in the right place.
I've done a search for dependencies and can't find anything.
All I know is that when I choose a store, the table IS being cleared, and it IS being populated with new information.
I just don't know where this information is coming from. I couldn't reproduce this if my life depended on it, because I have no idea what's happening here.
Can someone please help me to decipher what's going on here? I'll be happy to share any other pieces of code that you need.
Thank you
Marcie
Someone here actually created all of the logic for me last year.
I'm trying to document everything, and I cannot for the LIFE of me figure out how a particular table is being populated with the information.
Here's the Event Procedure for the "On Open" event of the report:
Code:
Private Sub Report_Open(Cancel As Integer)
'when the report opens the temporary table needs to be cleared
CurrentDb.Execute ("Delete * From ztblAislePages") 'delete records from table
' the recordset object needs to be opened so it can be used and accessible in the group footer and header sections
Set GrpPages = CurrentDb.OpenRecordset("ztblAislePages", DB_OPEN_TABLE) 'open the ztblAislePages recordset
GrpPages.Index = "Aisle" 'set the index so procedure knows what field to search
End Sub
Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As Integer)
'this is the group footer so set the previous aisle number variable
PrevAisle = Me.Aisle_Number
End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
'if this is a new aisle group header reset the page number and set the aisle number variable
If PrevAisle <> Me.Aisle_Number And PrevAisle <> "" Then
Me.Page = 1
PrevAisle = Me.Aisle_Number
End If
'Find the current aisle number in the temporary table
GrpPages.Seek "=", Me.Aisle_Number
If Not GrpPages.NoMatch Then 'if it exists and this is a new page for the aisle group - set the pages to this page number (equivalent of incrementing page by 1
'The group is already there.
If GrpPages![AislePage] < Me.Page Then
GrpPages.Edit 'initiate the recordset for editing
GrpPages![AislePage] = Me.Page 'increment page by one
GrpPages.Update 'update the row
End If
Else 'there is no record found for this aisle so
'This is the first page of the group. Add a new record
GrpPages.AddNew 'initiate the recordset for adding
GrpPages![Aisle] = Me.Aisle_Number 'set aisle number
GrpPages![AislePage] = Me.Page 'set the current page - which should be 1 because we reset it at the top of this procedure
GrpPages.Update 'update the row
End If
ExitProc:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " " & Err.Description
GoTo ExitProc
End Sub
ztblAislePages is a permanent table that holds temporary information...it's populated with information only for this report, and as you can see from the code above, it's cleared at the beginning of the process.
I cannot figure out where this information is coming from to populate the table, however.
The line
Code:
Set GrpPages = CurrentDb.OpenRecordset("ztblAislePages",DB_OPEN_TABLE)
doesn't tell me where the information is coming from.
The table itself has no source data that I can find, unless I'm not looking in the right place.
I've done a search for dependencies and can't find anything.
All I know is that when I choose a store, the table IS being cleared, and it IS being populated with new information.
I just don't know where this information is coming from. I couldn't reproduce this if my life depended on it, because I have no idea what's happening here.
Can someone please help me to decipher what's going on here? I'll be happy to share any other pieces of code that you need.
Thank you
Marcie