Results 1 to 6 of 6

Thread: Data Report Designer

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    London UK
    Posts
    5

    Question

    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

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100
    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.


  3. #3
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    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.


  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    London UK
    Posts
    5
    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

  5. #5
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    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.


  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    London UK
    Posts
    5
    Thanks for that, both answers worked!!

    Thanks all for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width