Okay I changed it to this:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
CurrentDb.Execute "DELETE ReportDay FROM tblReportDate"
Dim rsReser As DAO.Recordset
Set rsReser = CurrentDb.OpenRecordset("tblReportDate", dbOpenDynaset, dbSeeChanges)
Do While [frmReports]![StartDate] <= [frmReports]![EndDate]
Loop
Dim stDocName As String
stDocName = "Report1"
DoCmd.OpenReport stDocName, acPreview
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
But I get "Cannot find the expression "l" "
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
CurrentDb.Execute "DELETE ReportDay FROM tblReportDate"
Dim rsReser As DAO.Recordset
Set rsReser = CurrentDb.OpenRecordset("tblReportDate", dbOpenDynaset, dbSeeChanges)
Do While [frmReports]![StartDate] <= [frmReports]![EndDate]
Loop
Dim stDocName As String
stDocName = "Report1"
DoCmd.OpenReport stDocName, acPreview
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
But I get "Cannot find the expression "l" "