Results 1 to 10 of 10
  1. #1
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    126

    Disable a button on last record in a form ?


    I have a table with a field containing a path to a file.

    When presenting the records in a ongoing form I want a button on each record to open the file.

    IF there is a record the SHOULD be a path in the field and the button should then be anabled on every record EXCEPT on the "new record"

    I have tried to use the "current" event but it seems like it only fires at the first record !

    How can I implement that ?

  2. #2
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    What you are looking for is Conditional Formatting with a textbox that works like a button.

    1) Create a textbox that looks like a disabled button
    2) Set the textbox to disabled
    3) Click on conditional formatting > Choose Expression from the dropdown list
    4) In the expression field type [Path]<>""
    5) Click on the enabled button as a condition. It's a little button on the right and easy to miss. Also, make the button look like it's enabled through formatting of the background color and forecolor here.

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Could you use the form.update event to make the button visible and invisible based on whether there is a value in the form


    Sent from my iPhone using Tapatalk

  4. #4
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    It will work, Andy. Even the form_current event works if you click inside of a textbox in any row of the continuous view. Click the row below the one you're in and all buttons will change to enabled or disabled, not just the one for the current record.

  5. #5
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    126
    Quote Originally Posted by andy49 View Post
    Could you use the form.update event to make the button visible and invisible based on whether there is a value in the form


    Sent from my iPhone using Tapatalk
    That's what I tried but it seems like code for the current event ONLY runs when the form starts filling up with records - NOT when each single record is shown in the form !

    I'll try that comditional formatting - I've never used that in Access but a lot in Excel !

  6. #6
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    126
    Quote Originally Posted by AccessPower View Post
    What you are looking for is Conditional Formatting with a textbox that works like a button.

    1) Create a textbox that looks like a disabled button
    2) Set the textbox to disabled
    3) Click on conditional formatting > Choose Expression from the dropdown list
    4) In the expression field type [Path]<>""
    5) Click on the enabled button as a condition. It's a little button on the right and easy to miss. Also, make the button look like it's enabled through formatting of the background color and forecolor here.
    Huston we have a problem: Your point 1) - I can't change a textbox to a button - the item in the menu is disabled !

  7. #7
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    Glad we got this one solved together.

  8. #8
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    126
    Quote Originally Posted by AccessPower View Post
    Glad we got this one solved together.
    Together ? ... I don't think your method will work

  9. #9
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    If you look at my point #1, you'll see that I said to create a textbox that LOOKS LIKE a disabled button.

    Here's a sample. It works pretty well.

    Continuous Forms Criteria Buttons.zip

  10. #10
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    126
    Quote Originally Posted by AccessPower View Post
    If you look at my point #1, you'll see that I said to create a textbox that LOOKS LIKE a disabled button.

    Here's a sample. It works pretty well.

    Continuous Forms Criteria Buttons.zip
    Very sorry - it seems to work well - I just have the field and no "fake button" and it work fine too - thx

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

Similar Threads

  1. Replies: 1
    Last Post: 05-18-2016, 01:25 PM
  2. Replies: 9
    Last Post: 05-04-2014, 04:26 PM
  3. Replies: 3
    Last Post: 08-02-2012, 10:27 AM
  4. Continuous Form Disable Command Button
    By mbake085 in forum Programming
    Replies: 4
    Last Post: 05-27-2011, 08:55 AM
  5. Disable master form close button
    By Carpy01 in forum Forms
    Replies: 3
    Last Post: 12-31-2010, 05:41 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