I did a simple message box in the Report's On No Data event property and it works. The only thing is that it pops up twice and the the report pops up as well.
Ideally I would like it to pop up once and then have the report not pop up or close so quickly that no one sees.
Can I do that in the same On No Data event property code? What would I do. I tried "DoCmd.Close Report" but that just gave an error because in my form's code it's trying to open the report.
-- -CLSWL
"Duane Hookom" wrote:
[Quoted Text] > Normally this is handled in the Report's On No Data event property. > > Private Sub Report_NoData(Cancel As Integer) > MsgBox "No records to report", _ > vbOKOnly + vbInformation, "No Data" > Cancel = True > End Sub > > You might also need to trap and ignore err.number 2501 in the code that > opens the report. > > -- > Duane Hookom > MS Access MVP > > > "CLSWL" <CLSWL[ at ]discussions.microsoft.com> wrote in message > news:EE7E6204-7AE3-48D2-8438-53C8451836A0[ at ]microsoft.com... > >I have a form that "filters" a report. > > > > It works fine but now I would like to have a message pop up anytime the > > criteria entered has no results. Right now I get a report with no data. > > > > How to I capture the amount of records using VB? > > > > I run my report as follows: > > DoCmd.OpenReport "repAssyNo", acViewPreview, , strMod & "AND" & strDraw1 > > & > > "AND" & strDraw2, acWindowNormal > > > > > > > > -- > > -CLSWL > > >
|