PDA

Click to See Complete Forum and Search --> : Data Report Designer


PCrate
Aug 24th, 2000, 02:41 AM
Hi,

I have managed to create a report using VB6's new data environment. After running my program and adding datat to the table, I can preview the report, and all looks fine.

If I then close the report and make a change to the stored data, when I go back and preview the report, the data has not been updated.

Is there anyway to refresh the data connected to the data report. Or do I have to close the connection to the data environement and re-open it. If this is the case, how is this done in code, as I set up the data enviroment following the stages in a book.

I hope someone can help

Thanks
Paul Crate

rathi
Aug 24th, 2000, 05:53 AM
Originally posted by PCrate
Hi,

I have managed to create a report using VB6's new data environment. After running my program and adding datat to the table, I can preview the report, and all looks fine.

If I then close the report and make a change to the stored data, when I go back and preview the report, the data has not been updated.

Is there anyway to refresh the data connected to the data report. Or do I have to close the connection to the data environement and re-open it. If this is the case, how is this done in code, as I set up the data enviroment following the stages in a book.

I hope someone can help

Thanks
Paul Crate


Hi,

This is a reply from posted by Cenobite some times back.

Each time you view the report it is using the existing data in the data environment.

You will need to unload the data environment after viewing the report. Put the following into the reports QueryClose event. ( Substitute the name of the data environment )
Unload DataEnvironment1

I have tried this and it works.

Alternatively, you may be able to refresh the data environment before viewing the report but I have not tried this so I can't tell you how.


Thanks to cenobite.

Nathan
Aug 24th, 2000, 07:48 AM
Just a warning... if you close the environment you will loose all data in all of your commands and if your program requires to keep using some of that data you will have other problems other places.

Your best bet would be to close the command (recordset) and reopen it just before you display your report. I know this works as I have been doing it.

DE1.rsCommand.Close

Let me know if you need more help.

PCrate
Aug 25th, 2000, 03:30 AM
if I close the command, and then call the open method, I presume that I have to pass a string to the open command??

If so, what is the syntax and contents of the string. I have never used the open and close commands for the data environment. I used the data environment to set up the report and therefore had no code to write.

Thanks

Paul

Nathan
Aug 25th, 2000, 07:51 AM
To reOpen the command all you have to do is
DE1.CommandName

insert the name of your data environment at DE1 and the name of your command at Commandname.

PCrate
Aug 25th, 2000, 01:46 PM
Thanks for that, both answers worked!!

Thanks all for your help