I copied a table and report from a database that allows you to show a timeline in the report. It worked fine in my database after replacing the existing data with my own.
My problem occurs when I tried to rename the table and fields. I renamed Projects to tblProjects and for fields Start Date to StartDate (also End Date to EndDate). The report will no longer open. It asks if I want to debug, then highlights
the line that starts with Set rs =
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(“SELECT Min([Start Date]) AS MinOfStartDate ” _
& ” FROM Projects”, dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatEarliest = rs!MinOfStartDate
End If
Set rs = db.OpenRecordset(“SELECT Max(IIf(IsDate([End Date]),CDate([End Date]),Null)) ” _
& “AS MaxOfEndDate FROM Projects”, dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatLatest = rs!MaxOfEndDate
End If
I tried changing the Table and Field names in the code, but cannot get it to accept the changes. Can anyone suggest what I am doing wrong?
Thanks