Results 1 to 12 of 12
  1. #1
    kompkar is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    4

    Values in Text Boxes disappear when print preview

    I created a form which loads values into a report.



    When the report opens in 'Report' mode - acViewReport - I can see the values I set for the text boxes in the report.

    However when I press 'Print Preview', the values in the report disappear and all I can see are the 'label text' for the text boxes I setup in the Report

    -
    The code in the form that activate the report is

    Code:
    Private Sub Command0_Click()
    Dim reportname As New Report
    
    DoCmd.OpenReport "dfsdf", acViewReport, , , acWindowNormal
    Set reportname = Reports![dfsdf]
    reportname!Text0.SetFocus
    reportname!Text0.Text = "sdfsd"
     
    End Sub
    For this example, the only control on the report is a single text box called "Text0". and the only control on the form is a command button called "Command0"

    I'm using MS Access 2007 - MS Office 2007.

    The report is not linked to any tables or queries - I've code in the form which access the tables, does the calculations, and loads the final values into various text boxes which I've setup in the report. All works fine - the calculated values get displayed in the various text boxes in the report - but when I click Print Preview, the values disappear and only the labels stay on !

  2. #2
    kompkar is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    4

    here is the sample

    I've attached the sample DB for you guys to try out - please help - thanks

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The method you've chosen for completing the report field is not allowed nor does if work in Preview Mode.

  4. #4
    kompkar is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    4

    Thanks

    Thanks - any suggestions how I can accomplish what I'm trying to do - i.e dynamically set values to textboxes in a report and make it available in print preview mode as well !

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Putting your code in the Open event of the report might work.

  6. #6
    kompkar is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    4

    Tried that

    Tried that suggestion, it did not solve the problem - also tried load event, got focus event, on click event - but nothing worked

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I've not seen anyone try and run a report the way you are attempting so I guess I will not be of much help, sorry.

  8. #8
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    You can not change any thing in a report after it's open.

    You may try to initialze something in the report's event "Detail_Format". But the key point is how to pass value from the form to the report. I have tried many ways I found from internet but none successed (in Access 2003 ). Maybe you have better luck than me.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I have successfully set values on the report in the Open event of the Report passed to the report in the OpenArgs argument. These values were in the header of the report and not the Data Section.

  10. #10
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I tried the OpenArgs again, this time I got the value.

    Since the textbox of my report is in Detail section, I could not give value to the textbox in report open event(I think the textbox is not ready yet when open). I need to do in detail_format event.

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    When I do this I think I create Public variables in the Report and set their value in the OpenEvent and then bind controls in the Detail section to these variables. Just a thought.

  12. #12
    alaric01 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    17

    same problem

    i've got the same problem here. i have unbound text boxes Report Header and Report Section that are suppose to display the exact data as the the textboxes in the form.

    it's showing up perfectly in the report view, but shows nothing in print preview

    here's my code

    Code:
    txt_jumlah_grand_total = Forms!frm_main_sales_report.txt_jumlah_grand_total.Value
        
    txt_total_pembayaran = Forms!frm_main_sales_report.txt_total_pembayaran.Value
    i've tried the code in the open and load event of the report. and in the onclick button (in the form) that open up the report.

    anyone can show me example of how to use the openargs argument to accomplish this?

    thx

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 07-15-2010, 12:13 PM
  2. Print preview with forms
    By jonesy29847 in forum Reports
    Replies: 4
    Last Post: 07-13-2010, 10:36 AM
  3. Can't see sub report in print preview
    By LoggyDoggy in forum Access
    Replies: 1
    Last Post: 04-20-2010, 05:38 PM
  4. Print Preview different from Print Hardcopy
    By peterc in forum Reports
    Replies: 4
    Last Post: 10-27-2009, 05:35 AM
  5. Error when trying to print or print preview
    By TriAdX in forum Reports
    Replies: 8
    Last Post: 08-25-2009, 08:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums