Results 1 to 4 of 4
  1. #1
    Datament is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2023
    Posts
    39

    Make button not visible when TextBox in another form is NO

    I have two forms:
    1. frm_ACCT has txtPAY and a Checkbox Y/N that is checked
    (Y) whenever a payment received
    2. frm_Recvd has a command button btn_PmtRecvd. Btn_PmtRecvd is visible when form opens. I want to make Btn_PmtRecvd not visible when or if frm_ACCT Checkbox isn't checked.

    My code:
    In the On Load event of frm_Recvd[COLOR=var(--highlight-keyword)]
    if
    forms!frm_ACCT.Checkbox = -1 Then
    Btn_PmtRecvd.Visible = True
    Else
    Btn_PmtRecvd .Visible =False
    End If



    I hope you can review and tell me what I am doing wrong. Every suggestion would be appreciated.
    [/COLOR]

  2. #2
    Join Date
    Apr 2017
    Posts
    1,793
    On fly a possible universal solution:
    Have a global variable defined, which by default is False, and is reset True/False depending on value of checkbox in frm_ACCT;
    The visibility of button Btn_PmtRecieved on frm_Recieved is defined by value of this global variable.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    There's a few ways to do this but I don't think we know enough about your database.

    The simplest way may be to pass the value using openargs and and use that value in the onload event to hide/show the control.

    If frm_ACCT Checkbox is a bound field or there is some other field like payment date those can be used too, either as part of the forms source query or a dlookup.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Just a simple test reply. Please ignore.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Syntax to make command bar button visible
    By twgonder in forum Programming
    Replies: 2
    Last Post: 05-21-2023, 09:09 PM
  2. Replies: 6
    Last Post: 02-26-2016, 05:28 AM
  3. Use option button to make textbox not visible
    By Stephenson in forum Programming
    Replies: 4
    Last Post: 10-05-2015, 03:40 PM
  4. Replies: 1
    Last Post: 02-27-2015, 10:01 AM
  5. Replies: 6
    Last Post: 12-13-2014, 09:20 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