Results 1 to 4 of 4
  1. #1
    Chad Access is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    49

    Issue with Formatting for Printing

    Hello. I have some formatting code to change the width of text boxes - it works fine in OnLoad for viewing inside Access, but when I try to throw the code into OnFormat event to print (tried in the detail section, etc), it fails.



    Looking for help for next steps.

    UPDATE:

    The Me.Width = 1 says it can't be set after printing has started. Not sure what event to place this in.

    Also when I put this reports as subreports, the formatting doesn't work, but individually it does. Could it be I have to avoid using the "Me." reference?






    Me.[Assembly Machine Damage].Width = 1200
    Me.[AccessTotalsAssembly Machine Damage].Width = 1200
    Me.[AccessTotalsAssembly Machine Damage1].Width = 1200
    Me.[Assembly Machine Damage].BorderStyle = 1
    Me.[AccessTotalsAssembly Machine Damage].BorderStyle = 1
    Me.[AccessTotalsAssembly Machine Damage1].BorderStyle = 1


    Me.[Blemish].Width = 1000
    Me.[AccessTotalsBlemish].Width = 1000
    Me.[AccessTotalsBlemish1].Width = 1000
    Me.[Blemish].BorderStyle = 1
    Me.[AccessTotalsBlemish].BorderStyle = 1
    Me.[AccessTotalsBlemish1].BorderStyle = 1


    Me.[Contamination].Width = 1500
    Me.[AccessTotalsContamination].Width = 1500
    Me.[AccessTotalsContamination1].Width = 1500
    Me.[Contamination].BorderStyle = 1
    Me.[AccessTotalsContamination].BorderStyle = 1
    Me.[AccessTotalsContamination1].BorderStyle = 1


    Me.[Deformed].Width = 1000
    Me.[AccessTotalsDeformed].Width = 1000
    Me.[AccessTotalsDeformed1].Width = 1000
    Me.[Deformed].BorderStyle = 1
    Me.[AccessTotalsDeformed].BorderStyle = 1
    Me.[AccessTotalsDeformed1].BorderStyle = 1


    Me.[Different Color Slider].Width = 1000
    Me.[AccessTotalsDifferent Color Slider].Width = 1000
    Me.[AccessTotalsDifferent Color Slider1].Width = 1000
    Me.[Different Color Slider].BorderStyle = 1
    Me.[AccessTotalsDifferent Color Slider].BorderStyle = 1
    Me.[AccessTotalsDifferent Color Slider1].BorderStyle = 1


    Me.[Excessive Flash].Width = 1000
    Me.[AccessTotalsExcessive Flash].Width = 1000
    Me.[AccessTotalsExcessive Flash1].Width = 1000
    Me.[Excessive Flash].BorderStyle = 1
    Me.[AccessTotalsExcessive Flash].BorderStyle = 1
    Me.[AccessTotalsExcessive Flash1].BorderStyle = 1


    Me.[Extra Slider].Width = 1000
    Me.[AccessTotalsExtra Slider].Width = 1000
    Me.[AccessTotalsExtra Slider1].Width = 1000
    Me.[Extra Slider].BorderStyle = 1
    Me.[AccessTotalsExtra Slider].BorderStyle = 1
    Me.[AccessTotalsExtra Slider1].BorderStyle = 1


    Me.[Loose Slider].Width = 1000
    Me.[AccessTotalsLoose Slider].Width = 1000
    Me.[AccessTotalsLoose Slider1].Width = 1000
    Me.[Loose Slider].BorderStyle = 1
    Me.[AccessTotalsLoose Slider].BorderStyle = 1
    Me.[AccessTotalsLoose Slider1].BorderStyle = 1


    Me.[Missing Slider].Width = 1000
    Me.[AccessTotalsMissing Slider].Width = 1000
    Me.[AccessTotalsMissing Slider1].Width = 1000
    Me.[Missing Slider].BorderStyle = 1
    Me.[AccessTotalsMissing Slider].BorderStyle = 1
    Me.[AccessTotalsMissing Slider1].BorderStyle = 1


    Me.[Short Shot].Width = 1000
    Me.[AccessTotalsShort Shot].Width = 1000
    Me.[AccessTotalsShort Shot1].Width = 1000
    Me.[Short Shot].BorderStyle = 1
    Me.[AccessTotalsShort Shot].BorderStyle = 1
    Me.[AccessTotalsShort Shot1].BorderStyle = 1


    Me.[Translucent].Width = 1000
    Me.[AccessTotalsTranslucent].Width = 1000
    Me.[AccessTotalsTranslucent1].Width = 1000
    Me.[Translucent].BorderStyle = 1
    Me.[AccessTotalsTranslucent].BorderStyle = 1
    Me.[AccessTotalsTranslucent1].BorderStyle = 1
















    If (IsNull([Assembly Machine Damage])) Then
    Me.[Assembly Machine Damage].Width = 0
    Me.[AccessTotalsAssembly Machine Damage].Width = 0
    Me.[AccessTotalsAssembly Machine Damage1].Width = 0
    Me.[Assembly Machine Damage].BorderStyle = 0
    Me.[AccessTotalsAssembly Machine Damage].BorderStyle = 0
    Me.[AccessTotalsAssembly Machine Damage1].BorderStyle = 0
    Me.L6.Visible = False
    End If
    If (IsNull([Blemish])) Then
    Me.[Blemish].Width = 0
    Me.[AccessTotalsBlemish].Width = 0
    Me.[AccessTotalsBlemish1].Width = 0
    Me.[Blemish].BorderStyle = 0
    Me.[AccessTotalsBlemish].BorderStyle = 0
    Me.[AccessTotalsBlemish1].BorderStyle = 0
    Me.L2.Visible = False
    End If
    If (IsNull([Contamination])) Then
    Me.[Contamination].Width = 0
    Me.[AccessTotalsContamination].Width = 0
    Me.[AccessTotalsContamination1].Width = 0
    Me.[Contamination].BorderStyle = 0
    Me.[AccessTotalsContamination].BorderStyle = 0
    Me.[AccessTotalsContamination1].BorderStyle = 0
    Me.L5.Visible = False
    End If
    If (IsNull([Deformed])) Then
    Me.[Deformed].Width = 0
    Me.[AccessTotalsDeformed].Width = 0
    Me.[AccessTotalsDeformed1].Width = 0
    Me.[Deformed].BorderStyle = 0
    Me.[AccessTotalsDeformed].BorderStyle = 0
    Me.[AccessTotalsDeformed1].BorderStyle = 0
    Me.L4.Visible = False
    End If
    If (IsNull([Different Color Slider])) Then
    Me.[Different Color Slider].Width = 0
    Me.[AccessTotalsDifferent Color Slider].Width = 0
    Me.[AccessTotalsDifferent Color Slider1].Width = 0
    Me.[Different Color Slider].BorderStyle = 0
    Me.[AccessTotalsDifferent Color Slider].BorderStyle = 0
    Me.[AccessTotalsDifferent Color Slider1].BorderStyle = 0
    Me.L10.Visible = False
    End If
    If (IsNull([Excessive Flash])) Then
    Me.[Excessive Flash].Width = 0
    Me.[AccessTotalsExcessive Flash].Width = 0
    Me.[AccessTotalsExcessive Flash1].Width = 0
    Me.[Excessive Flash].BorderStyle = 0
    Me.[AccessTotalsExcessive Flash].BorderStyle = 0
    Me.[AccessTotalsExcessive Flash1].BorderStyle = 0
    Me.L11.Visible = False
    End If
    If (IsNull([Extra Slider])) Then
    Me.[Extra Slider].Width = 0
    Me.[AccessTotalsExtra Slider].Width = 0
    Me.[AccessTotalsExtra Slider1].Width = 0
    Me.[Extra Slider].BorderStyle = 0
    Me.[AccessTotalsExtra Slider].BorderStyle = 0
    Me.[AccessTotalsExtra Slider1].BorderStyle = 0
    Me.L8.Visible = False
    End If
    If (IsNull([Loose Slider])) Then
    Me.[Loose Slider].Width = 0
    Me.[AccessTotalsLoose Slider].Width = 0
    Me.[AccessTotalsLoose Slider1].Width = 0
    Me.[Loose Slider].BorderStyle = 0
    Me.[AccessTotalsLoose Slider].BorderStyle = 0
    Me.[AccessTotalsLoose Slider1].BorderStyle = 0
    Me.L3.Visible = False
    End If
    If (IsNull([Missing Slider])) Then
    Me.[Missing Slider].Width = 0
    Me.[AccessTotalsMissing Slider].Width = 0
    Me.[AccessTotalsMissing Slider1].Width = 0
    Me.[Missing Slider].BorderStyle = 0
    Me.[AccessTotalsMissing Slider].BorderStyle = 0
    Me.[AccessTotalsMissing Slider1].BorderStyle = 0
    Me.L1.Visible = False
    End If
    If (IsNull([Short Shot])) Then
    Me.[Short Shot].Width = 0
    Me.[AccessTotalsShort Shot].Width = 0
    Me.[AccessTotalsShort Shot1].Width = 0
    Me.[Short Shot].BorderStyle = 0
    Me.[AccessTotalsShort Shot].BorderStyle = 0
    Me.[AccessTotalsShort Shot1].BorderStyle = 0
    Me.L7.Visible = False
    End If
    If (IsNull([Translucent])) Then
    Me.[Translucent].Width = 0
    Me.[AccessTotalsTranslucent].Width = 0
    Me.[AccessTotalsTranslucent1].Width = 0
    Me.[Translucent].BorderStyle = 0
    Me.[AccessTotalsTranslucent].BorderStyle = 0
    Me.[AccessTotalsTranslucent1].BorderStyle = 0
    Me.L9.Visible = False
    End If


    Me.Width = 1

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    seems a lot of duplication of code - why change the width? set it in design view then make visible or not as required

    so instead of these 5 lines

    Me.[Missing Slider].Width = 1000
    Me.[Missing Slider].BorderStyle = 1
    If (IsNull([Missing Slider])) Then
    Me.[Missing Slider].Width = 0
    Me.[Missing Slider].BorderStyle = 0

    you need just 1

    Me.[Missing Slider].visible= not (IsNull([Missing Slider]))



    No idea what 'it fails' means so can't really help

  3. #3
    Chad Access is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    49
    Thanks for the suggestion, I'll definitely shorten the code.

    It fails meaning, if export to PDF as an individual report, the columns with no data disappear, but when it's a subreport, none of the formatting occurs. All columns are visible. I assume the code is not firing because of the event that it's in, or perhaps I cannot use the relative references.


    UPDATE: I was mistaken, I think it is working now.

  4. #4
    Chad Access is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    49
    My issue now is that subreports do not format until I click on them (in report view, not while printing)

    Any ideas?

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

Similar Threads

  1. formatting issue
    By aamer in forum Access
    Replies: 5
    Last Post: 12-14-2018, 10:22 PM
  2. Formatting Issue
    By JohnnyDarkside in forum Access
    Replies: 2
    Last Post: 08-01-2017, 11:37 AM
  3. Access printing issue
    By SunTop in forum Access
    Replies: 13
    Last Post: 10-12-2016, 07:48 AM
  4. printing issue
    By mad4mp3z in forum Access
    Replies: 5
    Last Post: 07-28-2016, 10:06 AM
  5. Access2003 printing issue on Windows 7
    By bykerbob in forum Access
    Replies: 1
    Last Post: 12-27-2011, 11:01 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