Vba code to disable button when certain stock =0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mmcwilliams
    New Member
    • Sep 2012
    • 2

    Vba code to disable button when certain stock =0

    I have created a database for the company I work for. Its a simple stock in/out database. In one form I have buttons which enable the user to remove a kit. A kit consists of 'x' amount of parts. But I want the user to be informed when a certain part in the stock is at 0.
    Idealy I would prefer it if the button was disabled whenever one part is out of stock. How can I do this using VBA?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can set the enabled property of the button to false and that will disable it.
    Code:
    If stock = 0 Then
       buttonName.Enabled = False
    End If

    Comment

    • Mmcwilliams
      New Member
      • Sep 2012
      • 2

      #3
      I need it to be more specific. There are 6 parts within the 'ASM-00065' table and if one of them = 0 then the button needs to be disabled.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can make it as specific as you want. That was just an example of how to use an if condition to disable a control. You can use whatever complex condition you need in your if clause.

        Comment

        Working...