Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Screen updates to report (2K)

    I cannot seem to find the correct way to repaint (at least I think this is what I want) a report.

    What I am doing is opening a report through a command button, that filters the report according to criteria on the form. The vb code behind the button first creates a string that is used in the wherecondition part of the docmd.openreport method. I then open the report in preview view. I then set an unbound textbox in the report header to summarize the criteria that was used. The value makes it into the textbox and is there when I print the report, but I can't seem to update the screen to reflect the value that I set, so it is blank when I preview the report.

    I have tried docmd.RepaintObject, but that doesn't work. Can anyone point me in the correct direction?

    Thanks, K.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Screen updates to report (2K)

    I don't understand the last sentence you wrote:

    "...I then set an unbound textbox in the report header to summarize the criteria that was used. The value makes it into the textbox and is there when I print the report, but I can't seem to update the screen to reflect the value that I set, so it is blank when I preview the report."

    What are you updating on the screen that is not on the report? I thought the screen contains your selection criteria?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen updates to report (2K)

    The string that summarizes the criteria is what I am having troubling viewing. It is there in that I see it in the vb immediate window or when I print the report, but I do not see it in the screen preview of the report.

    I know the Report contains the criteria in the textbox, but the screen does not show it. Which to me seems like I just need to repaint the screen. But since that isn't working, I'm obviously missing something.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Screen updates to report (2K)

    You should set the value of the text box in the On Format (or On Print) event of the report header. The contents of a report are set in the On Format / On Print events of the various sections.

  5. #5
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen updates to report (2K)

    That worked. The problem was that I was treating the report like a form. Thanks much. -K

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Screen updates to report (2K)

    Oh, I understand now. I was confused about repainting the screen, and I thought it had to do with the form, not the report.

    How are you setting the textbox? From the calling form or from inside the report? If you can create a textbox on your calling form and stick the criteria string in that (you can make it invisible), then you can use this as the controlsource for your textbox on the report. This should then display in preview or print modes.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    Star Lounger
    Join Date
    Sep 2002
    Location
    New York, New York
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen updates to report (2K)

    You were probably confused b/c I was confused...

    I'm now setting the textbox on the report (OnPrint event) by using a global variable to hold the criteria summary string which is set when I click the command button. I should have thought of using the hidden textbox on the form, though. That would have circumvented my lack of knowledge about those report events. My knowledge of forms has been growing greatly, but this has shown me that I only know a lot less about report design than I thought. Always so much more to learn...

Posting Permissions

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