Validate Date for a Report

F

flores

I have a working report that uses a qryPost_Date and qryEmploye_ID to display
records on a report. The report works fine, but I am trying to check the
date to be a valid date value, when the report is executed directly from the
report list in Access (no form interface opens the report). If the date is
invalid, I like to show the wrongly typed date in a message.

When opening the report, the user types a value for the qryPost_Date. My
question is what is the syntax needed to gain visibility to the qryPost_Date
value? Also, what report event is the most appropriate to display the error
message to the user?

Below is the event I am trying to use, but I do not know how to stop report
execution. What should Response variable be set to stop execution?


Private Sub Report_Error(DataErr As Integer, Response As Integer)

' Error 3071 occured; this is due to a wrong date typed (I need the value
typed)
If DataErr = 3071 Then
MsgBox "The date keyed is invalid.", , "Report Monthly Hours by
Employee"
' Response = acDataErrDisplay '
Response = acDataErrContinue ' tell Access to continue execution.
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top