Elana
04-25-2000, 01:24 PM
I have over 50 reports that need to run each month. Some have data, others do not. On the "on no data" event in each report, I've created a procedure that enters the name of the report in a separate table that tracks which reports did not print. Here is my code:
Private Sub Report_NoData(Cancel As Integer)
Flag = 1
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblPrintedReports")
If Flag = 1 Then
rst.AddNew
rst!ReportName = "John Doe"
rst!PrintDate = Date
rst.Update
DoCmd.CancelEvent
End If
End Sub
Right now I have to change each of the 50 reports to reflect which name I want stored in the table i.e.,. rst!ReportName = "John Doe" and on the next report it will be rst!ReportName = "Jane Smith", etc.
I can't seem to figure out how to populate a control with the actual name of the report, i.e., rst!ReportName = (Name of CurrentReport)
Any help will be much appreciated!
Private Sub Report_NoData(Cancel As Integer)
Flag = 1
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblPrintedReports")
If Flag = 1 Then
rst.AddNew
rst!ReportName = "John Doe"
rst!PrintDate = Date
rst.Update
DoCmd.CancelEvent
End If
End Sub
Right now I have to change each of the 50 reports to reflect which name I want stored in the table i.e.,. rst!ReportName = "John Doe" and on the next report it will be rst!ReportName = "Jane Smith", etc.
I can't seem to figure out how to populate a control with the actual name of the report, i.e., rst!ReportName = (Name of CurrentReport)
Any help will be much appreciated!