Results 1 to 4 of 4
  1. #1
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52

    Making objects visible in a report

    Hello all, I have a report with certain boxes and labels that I need to be visible based on the value of a checkbox. The code that I have works ONLY IF I print preview first. I have a button that directly prints the report and when I click this it bypasses the code and automatically sets it to visible. Here is what I have:

    Private Sub Report_Load()
    On Error GoTo Err_Report_Load

    If Me.Asterisk.Value = -1 Then
    Me.MTDescription.Visible = True
    Me.MTOp.Visible = True
    Me.MTOpDate.Visible = True
    Me.MTAcceptBox.Visible = True
    Me.MTRejectBox.Visible = True
    Me.MTAccept.Visible = True
    Me.MTReject.Visible = True
    Me.MTBox1.Visible = True
    Me.MTBox2.Visible = True


    Me.MTBox3.Visible = True
    Me.MTAcceptBox.Visible = True
    Me.MTRejectBox.Visible = True
    Me.MTReference.Visible = True
    Else
    Me.MTDescription.Visible = False
    Me.MTOp.Visible = False
    Me.MTOpDate.Visible = False
    Me.MTAcceptBox.Visible = False
    Me.MTRejectBox.Visible = False
    Me.MTAccept.Visible = False
    Me.MTReject.Visible = False
    Me.MTBox1.Visible = False
    Me.MTBox2.Visible = False
    Me.MTBox3.Visible = False
    Me.MTAcceptBox.Visible = False
    Me.MTRejectBox.Visible = False
    Me.MTReference.Visible = False
    End If

    Exit_Report_Load:
    Exit Sub

    Err_Report_Load:
    MsgBox Err.Description
    Resume Exit_Report_Load

    End Sub



    Any help would be greatly appreciated.

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    I'm assuming that the information is in the detail secton of your report. Use your code in the "On Print" event in the detail section instead of the Load event. That should solve the problem.

    Dan
    Access Development

    Quote Originally Posted by Lockrin View Post
    Hello all, I have a report with certain boxes and labels that I need to be visible based on the value of a checkbox. The code that I have works ONLY IF I print preview first. I have a button that directly prints the report and when I click this it bypasses the code and automatically sets it to visible. Here is what I have:

    Private Sub Report_Load()
    On Error GoTo Err_Report_Load

    If Me.Asterisk.Value = -1 Then
    Me.MTDescription.Visible = True
    Me.MTOp.Visible = True
    Me.MTOpDate.Visible = True
    Me.MTAcceptBox.Visible = True
    Me.MTRejectBox.Visible = True
    Me.MTAccept.Visible = True
    Me.MTReject.Visible = True
    Me.MTBox1.Visible = True
    Me.MTBox2.Visible = True
    Me.MTBox3.Visible = True
    Me.MTAcceptBox.Visible = True
    Me.MTRejectBox.Visible = True
    Me.MTReference.Visible = True
    Else
    Me.MTDescription.Visible = False
    Me.MTOp.Visible = False
    Me.MTOpDate.Visible = False
    Me.MTAcceptBox.Visible = False
    Me.MTRejectBox.Visible = False
    Me.MTAccept.Visible = False
    Me.MTReject.Visible = False
    Me.MTBox1.Visible = False
    Me.MTBox2.Visible = False
    Me.MTBox3.Visible = False
    Me.MTAcceptBox.Visible = False
    Me.MTRejectBox.Visible = False
    Me.MTReference.Visible = False
    End If

    Exit_Report_Load:
    Exit Sub

    Err_Report_Load:
    MsgBox Err.Description
    Resume Exit_Report_Load

    End Sub



    Any help would be greatly appreciated.

  3. #3
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52
    That worked great! Thank you very much.

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    YW. Glad you got it working.

    Dan
    Access Development

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

Similar Threads

  1. Replies: 5
    Last Post: 01-29-2010, 11:09 AM
  2. Making report for tracking production
    By winniepoohbear38501 in forum Reports
    Replies: 1
    Last Post: 01-28-2010, 09:06 PM
  3. Replies: 7
    Last Post: 01-07-2010, 12:20 PM
  4. Tab only visible when field = x
    By ecpike in forum Forms
    Replies: 7
    Last Post: 06-08-2009, 04:38 PM
  5. Making report from 2 queries
    By QueeN in forum Reports
    Replies: 1
    Last Post: 04-20-2009, 01:36 PM

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