Results 1 to 5 of 5
  1. #1
    VariableZ's Avatar
    VariableZ is offline Partially Knowledgeable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Georgia, USA
    Posts
    40

    Fields Go Blank On Print Preview

    Access 2007 SP3 32bit


    Windows 7 64bit
    Dell Optiplex 790

    I have a field in a report that has no control source. Instead, its value is provided via a defined global variable, gblATVsDuringTimePeriod, by the following VBA code in the report's Load event:

    ATVsDuringTimePeriod.Value = gblATVsDuringTimePeriod

    It works fine, and any fields based on the value also work fine... until you Print Preview the report, at which point the field and any fields calculated off of it go blank. If I just Print instead of Print Preview, everything prints fine, but if I Print Preview first, the fields are blank, even on the printed document.

    I tried putting the code into the Open event, but Access didn't like that.

    Is there anything that I can do to stop the fields from going blank, short of telling the users not to look at the print preview?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    We would need to see some code and or some screenshots to help with this!

  3. #3
    VariableZ's Avatar
    VariableZ is offline Partially Knowledgeable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Georgia, USA
    Posts
    40
    Ok, I think I just figured this out. Instead of setting the textbox's value in the Load or Open events, I put

    Me.ATVsDuringTimePeriod = gblATVsDuringTimePeriod
    In both the Paint and Format events of the section that the textbox resides in. The Format event makes the value show up in the Print Preview and Paint makes it show up in the Normal View.

    Does this seem like a reasonable fix/workaround for this issue, or am I setting myself up for more problems down the road?

    I'm including a picture to illustrate the problem I've been having:
    Click image for larger version. 

Name:	ScreenShotPrintPreviewIssue.jpg 
Views:	6 
Size:	132.9 KB 
ID:	11485

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Glad to see you got it working. Good Luck with your project.

  5. #5
    VariableZ's Avatar
    VariableZ is offline Partially Knowledgeable
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Georgia, USA
    Posts
    40
    I'll go ahead and mark this as closed, then.

    EDIT:
    I just found out that I can create a function as so:

    Public Function ATVsDuringTimePeriodFunction() As String
    ATVsDuringTimePeriodFunction = gblATVsDuringTimePeriod
    End Function

    And call the function as the control source of the Text Box as so:
    =ATVsDuringTimePeriodFunction()

    And get rid of the Paint and Format functions. I like it a lot better.
    This is my first function.

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

Similar Threads

  1. Print & Print Preview Differ
    By IDH in forum Reports
    Replies: 3
    Last Post: 07-25-2012, 09:50 AM
  2. print preview
    By rmohebian in forum Access
    Replies: 4
    Last Post: 02-14-2011, 08:10 AM
  3. Replies: 1
    Last Post: 01-10-2011, 01:08 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