Reporting an error?

dcarr

Trainee Database Analyst
Local time
Today, 06:09
Joined
Jun 19, 2002
Messages
112
I have created several queries of the format Like "*" & [Enter first initial of Surname] & "*".
This query prompts the user for some input which they have to respond to. If the data is found great, but if it is not is there any way of reporting this via the query? With an error message 'Data not found'? Rather than simply return a blank row from the table? Thanks
 
Not that I know of via a query, (although someone else may be able to clarify that). But if you do it via a report, there's an option for OnNoData on the Event tab of the report.

In the code here, put

Code:
Private Sub Report_NoData(Cancel As Integer)
msgbox "No data to view", vbOKOnly, "No Records"
Cancel = True

End Sub

Sometimes another error can be thrown up about "the action was cancelled" and there's some more code you can put in which I'd need to look up.

HTH
 

Users who are viewing this thread

Back
Top Bottom