greyed out command button-how to accomplish

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sprint45
    New Member
    • Oct 2006
    • 7

    greyed out command button-how to accomplish

    All,

    I have a form called books that shows the book information and a lookup field that shows who has the book checked out. On the side i have command buttons for ADD, DELETE, NEXT RECORD, PREVIOUS RECORD nad CLOSE. I want to create a greyed out DELETE button so that the record cannot be deleted if the book is checked out (data in the chk'd out lookup field). if the field is empty or indicates an "in house" condition then the delete button is active. How would i do this and any help with the VBA code would be appreciated.

    Thanks
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by Sprint45
    All,

    I have a form called books that shows the book information and a lookup field that shows who has the book checked out. On the side i have command buttons for ADD, DELETE, NEXT RECORD, PREVIOUS RECORD nad CLOSE. I want to create a greyed out DELETE button so that the record cannot be deleted if the book is checked out (data in the chk'd out lookup field). if the field is empty or indicates an "in house" condition then the delete button is active. How would i do this and any help with the VBA code would be appreciated.

    Thanks
    Set the enabled property of the button to False at runtime:

    cmdDelete.Enabl ed = False

    and reset it if you want the user to be able to delete

    cmdDelete.Enabl ed = True

    Comment

    • Sprint45
      New Member
      • Oct 2006
      • 7

      #3
      thanks, but if i'm not mistaken that means I have to change it to allow the user or me to delete. I want the program to recognize the CHk'd out fiels and determine the staus of the DELETE command button on its own.

      Comment

      Working...