Results 1 to 3 of 3
  1. #1
    ali_sh is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    21

    Add button and set that's visibility using vba

    Hello
    I added a button to report for each record.


    I need a vba code to change visibility of the button according to number in a field of table in each row.
    Can you help me write this code?
    Thanks in advance

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Button will only be interactive when report is in ReportView, not PrintPreview. Code setting visibility property of a control has to be in Format event and Format event executes only for PrintPreview (or direct to printer). Therefore, can't do what you want with button. Can make a textbox look sort of like a button or a hyperlink and use Conditional Formatting to enable/disable.

    Forms are intended to be interactive and reports for display.
    Last edited by June7; 11-16-2019 at 06:31 AM.
    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.

  3. #3
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Hmm, if this is on a continuous Form then you can't do it that way. Technically there is only one button and it is either visible or not visible. Perhaps something like this will give you the desired result...
    https://regina-whipp.com/blog/?p=1227

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

Similar Threads

  1. Visibility
    By Perfac in forum Forms
    Replies: 14
    Last Post: 08-25-2018, 01:49 AM
  2. Continuous Form command button visibility
    By kdbailey in forum Access
    Replies: 6
    Last Post: 03-23-2017, 12:43 PM
  3. Label Visibility
    By joecamel9166 in forum Reports
    Replies: 3
    Last Post: 05-03-2016, 05:24 PM
  4. Replies: 11
    Last Post: 02-09-2016, 07:45 AM
  5. Visibility of other controls
    By jlclark4 in forum Forms
    Replies: 7
    Last Post: 12-15-2010, 12:34 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