How to input text in Report Header on runtime, not from table

B

bstullos

I am prompting for input(the month) for the header, and it works unless the
results of the query has 0 records. Then it turns into an error. Is there
another way to do this?
 
O

Ofer

Use the OnNoData Property of the report to display a message that there is no
data, and then close the report

Private Sub Report_NoData(Cancel As Integer)
MsgBox "No Data"
Cancel = True
End Sub
 
B

bstullos

But I need the input(month) to actually print out for audit purposes to show
that I did run it, and that it was for the month that I entered. The report
works, and there are 0 records. The problem is that the header does not
display the month for which the report was run. It also comes up blank.

Any suggestions?
 
D

Duane Hookom

Add an unbound text box to your report header and name it "txtMonth".
Then add code to the On Format event of the report header section.

Me.txtMonth = InputBox("Enter Month")
 
Top