ferrethouse
Jul 7 2006, 03:11 PM
I have a report call Report_rptAnalysis. The user clicks on a "Generate Report" button and I put a breakpoint in the code follow the execution.
I step through this function which does nothing...
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
'SplitLine.visible = Not NewPage
End Sub
Then the next line of code executed is another function...
Function getSig(grp As String) As Variant
Select Case grp
Case "OH"
getSig = Forms!frmAnalysis!frmAnalysisInfo.Form!OHReviewer
Case "TO"
getSig = Forms!frmAnalysis!frmAnalysisInfo.Form!TraceReviewer
Case "WT"
getSig = Forms!frmAnalysis!frmAnalysisInfo.Form!WaterReviewer
Case "SO"
getSig = Forms!frmAnalysis!frmAnalysisInfo.Form!SoilReviewer
End Select
End Function
I don't understand how it decided to call this second function. I stepped through the code and it went directly from function PageFooter_Format to function getSig without even calling getSig. How did it do this?!? The variable being passed into getSig is wrong and I want to debug it but it seems to spontaneously call the function. I don't see where the variable is being passed in. What is going on???
fkegley
Jul 7 2006, 03:24 PM
Has this report worked in the past?
Something is telling it to call the function. Could there be a control on the report that uses this function? Or on a subreport?
You could set breakpoints on each sub where you have some code and see how it goes when you open the report.
ferrethouse
Jul 7 2006, 03:31 PM
I'm not sure Frank. I am very new to Access. The only thing I know is that when stepping through the code in debug mode it goes directly from this line...
End Sub <-- in the function called "PageFooter_Format"
to this line...
Function getSig(grp As String) As Variant
Edited by: ferrethouse on Fri Jul 7 16:32:19 EDT 2006.
fkegley
Jul 7 2006, 03:47 PM
Well, something ahead of that is causing it to occur. There may be a control on the form that is using getSig to as its Control Source.
Put a breakpoint on each sub that has some code attached to it. Then open the report in Preview and step thru the code with the F8 key.
ferrethouse
Jul 7 2006, 04:00 PM
Yes indeed. There was a control on the form that had that as its source...
=DLookUp("LoginName & ', ' & title","tblSignatures","LoginName = '" & getSig([GroupName]) & "'")
Thanks Frank. I just didn't understand the flow. I guess Access processes the click event of the button but also runs all the functions tied directly to controls. It through me off when stepping through the code but now I understand.
fkegley
Jul 7 2006, 04:18 PM
Yes, it would have to do that before it could complete the page. So it looks like, it completed the Footer_Format then filled in the control.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.