Results 1 to 3 of 3
  1. #1
    StuartR is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Scotland
    Posts
    46

    hiding a button on a report line

    Hi,



    I have a report on members which has a field called [membership_class]

    Each line of the report also has a couple of buttons which when clicked open up different forms for that specific member. This works fine.

    Is it possible to show or hide one of these buttons dependent on the value of [membership_class]

    The code I have been trying (and variations of this) is as follows, but the button refuses to become invisible.

    Code:
    Private Sub Report_Current()
    If Me.Membership_Class = "Family (Lead)" Then
    RemFamBttn.Visible = False
    Else
    RemFamBttn.Visible = True
    End If
    End Sub
    I have tried this both On-Load, and Current subs.

    The above seems to work on my Forms, but not on Reports. Is that correct?

    Any suggestions would be appreciated.

    Stuart

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    1. why would you have buttons on a report to open forms?

    2. use the ON PRINT event:
    RemFamBttn.Visible =not Me.Membership_Class = "Family (Lead)"

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    AFAIK, the only way buttons on report can work is in ReportView, not PrintPreview. OnPrint event only triggers in PrintPreview or direct to printer (same as OnFormat) .

    Trying to make a report act like a form (or vice versa) has challenges. Instead of buttons, textboxes can be made to look like a hyperlink and their click event can execute code to open form. A textbox Conditional Formatting can then manage the Enabled property, although it will still be visible. I think this is the best you can achieve with report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-23-2015, 08:32 AM
  2. Hiding an Empty Sub-report
    By ophirw in forum Reports
    Replies: 16
    Last Post: 10-04-2011, 09:37 AM
  3. Hiding checkbox on report
    By bluezidane in forum Reports
    Replies: 2
    Last Post: 06-29-2011, 12:46 PM
  4. Button hiding when filter on
    By rstonehouse in forum Forms
    Replies: 2
    Last Post: 08-25-2010, 06:24 AM
  5. Replies: 2
    Last Post: 07-12-2010, 05:39 AM

Tags for this Thread

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