Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keep the report open without any record returned!
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00352954
Message ID:
00353788
Views:
19
You've got it almost right.

I'm assuming you're calling the report from a form method (like a Button Click() ) or a PRG. You should remove the code from the report INIT and put it into the calling program.

1) Remove all tables from the report DE

2) Remove all code from the report Init()

3) In the code that calls the report, put your View requery() and your check for data:
** Set the parameters and update the view
cProdName = "Widgets"
cQuality = "Good"

sele v_MyView
requery()

** Now you have the view with the correct parameters, so you check it to see if there are any records
if _tally = 0
      =Messagebox("No Records Found", 16, "Report")
else
      Report Form MyReport Preview
endif
Finally, if you are putting code in the INIT() method of a form or report and you don't want to run it (as when there are no records) you add a RETURN .F. to your code:

If _tally = 0
=Messagebox("No Records Found", 16, "Report")
return .F.
** Report has now exited back to the calling program.
endif

HTH
Barbara

>Hello Barbara,
>
> Thank you so very very much for your help.
> Like you assumed, it's a parameterized view with parameters for Product Name and Quality fields. Let me tell you about what I did after reading your second mail.
> I tried to go to DataEnvironment of the report, then Cursor's Properties, and I put the code that Dave suggested in the "Init" Method. The report works fine but seems slower than before. And another thing here is if there is no record to be returned, I got the notice message(what I desire), click "Ok"(on the messagebox) to get out, the report flashs very fast. Do you think that all of those "symptoms" are "normal"? Did I do the coding in the right place, the right way? How about the _tally method? Will it give the same result?
> Once, I am looking forward hearing from you. God bless you.
> Diane.
>
Barbara Paltiel, Paltiel Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform