Z
zSplash
I've created a "parameterForm" to allow me to get input. So, I open the
"pForm", get input, then open the query, open the report, close the query,
close the "pForm".
The screen output looks fine -- the value for the textbox related to the
parameter query/form is 45; when I print the report, however, it prints an
"#Error" for the value.
A clue (which I can't decipher) might be the following: I have a label in
the report that I "fill" from VBA, based on the value of a textbox in the
parameterForm; I have no such label on the form; what I see on the screen
does not "fill" the label, but the printed report has the label caption.
Maybe I'm not looking at the report on the screen, but at the form (which I
never opened, but from which I created the report).
Here is my VBA code:
Private Sub cmbOK_Click()
Dim closeIt As Integer, theTerm As String
DoCmd.OpenQuery ("yqCUS")
DoCmd.OpenReport "rStats", acViewPreview
theTerm = Application.Forms("fgetStats").Controls("tbxBegDate") & " - "
& Application.Forms("fgetStats").Controls("tbxEndDate")
Application.Reports("rStats").Controls("labTerm").Caption = theTerm
DoCmd.Close acQuery, "yqCUS", acSaveNo
DoCmd.Close acForm, "fGetStats", acSaveNo
DoCmd.PrintOut acPrintAll
closeIt = MsgBox("Close report?", vbYesNo, "Close report?")
If closeIt = 6 Then
DoCmd.Close acReport, "rStats", acSaveNo
End If
End Sub
Can somebody help me understand the discrepancy between what I see and what
I print? (?)
TIA
"pForm", get input, then open the query, open the report, close the query,
close the "pForm".
The screen output looks fine -- the value for the textbox related to the
parameter query/form is 45; when I print the report, however, it prints an
"#Error" for the value.
A clue (which I can't decipher) might be the following: I have a label in
the report that I "fill" from VBA, based on the value of a textbox in the
parameterForm; I have no such label on the form; what I see on the screen
does not "fill" the label, but the printed report has the label caption.
Maybe I'm not looking at the report on the screen, but at the form (which I
never opened, but from which I created the report).
Here is my VBA code:
Private Sub cmbOK_Click()
Dim closeIt As Integer, theTerm As String
DoCmd.OpenQuery ("yqCUS")
DoCmd.OpenReport "rStats", acViewPreview
theTerm = Application.Forms("fgetStats").Controls("tbxBegDate") & " - "
& Application.Forms("fgetStats").Controls("tbxEndDate")
Application.Reports("rStats").Controls("labTerm").Caption = theTerm
DoCmd.Close acQuery, "yqCUS", acSaveNo
DoCmd.Close acForm, "fGetStats", acSaveNo
DoCmd.PrintOut acPrintAll
closeIt = MsgBox("Close report?", vbYesNo, "Close report?")
If closeIt = 6 Then
DoCmd.Close acReport, "rStats", acSaveNo
End If
End Sub
Can somebody help me understand the discrepancy between what I see and what
I print? (?)
TIA