Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Report Count using Visual Basic

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Report Count using Visual Basic
CLSWL 29.08.2006 21:19:02
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
Re: Report Count using Visual Basic
"Duane Hookom" <DuaneAtNoSpanHookomDotNet> 29.08.2006 21:56:04
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...
[Quoted Text]
>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


Re: Report Count using Visual Basic
CLSWL 30.08.2006 15:04:02
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
>
>
>
Re: Report Count using Visual Basic
"Duane Hookom" <DuaneAtNoSpanHookomDotNet> 30.08.2006 15:30:52
Can you provide the code that you used? Was it the same as what I suggested?

--
Duane Hookom
MS Access MVP

"CLSWL" <CLSWL[ at ]discussions.microsoft.com> wrote in message
news:C8742B59-3D86-4EC0-8AC5-707D017C44AD[ at ]microsoft.com...
[Quoted Text]
>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:
>
>> 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
>>
>>
>>


Re: Report Count using Visual Basic
CLSWL 30.08.2006 17:55:01
I forgot the cancel part of it, let me try again.
--
-CLSWL


"Duane Hookom" wrote:

[Quoted Text]
> Can you provide the code that you used? Was it the same as what I suggested?
>
> --
> Duane Hookom
> MS Access MVP
>
> "CLSWL" <CLSWL[ at ]discussions.microsoft.com> wrote in message
> news:C8742B59-3D86-4EC0-8AC5-707D017C44AD[ at ]microsoft.com...
> >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:
> >
> >> 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
> >>
> >>
> >>
>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net