enabled/disable button off selection in combo box

  • Thread starter evilcowstare via AccessMonster.com
  • Start date
E

evilcowstare via AccessMonster.com

Hello Everyone,

I would like to be able to make a button only enabled when a particular
selection is made from a combo box.

I have done it before that it is only enabled when the combo box has an entry
in it but is it possible to make it work only when say 1 of the 4 things in
the combo box is selected but does nothing if any of the other 3 are chosen.

I used this before in the After Update

operativebutton.Enabled = Not IsNull(operativecombo)

how can i make it do it with a field within the combo, is it something like
(operativecombo.fieldID2)??

Thanks
 
A

Al Campagna

Evil,
Right Now, you have 4 values from the combo that would "enable" the button?
If so, there's a better solution, that will save you from having to reprogram the
enabling... if... in the future... more Items would cause "enabling"
Consider this example table to feed your combo selections...
Item Enable
1234-1 False
51420 True
13329 True
71654 False

Add Enable to your combo (say, the second colum) On the AfterUPdate event of the combo
(ex. cboItem)
If Me.cboItem.Column(1) = True Then
cmdButton.enabled = True
Else
cmdButton.enabled = False
End If
(Combo columns are numbered left to Right as 0, 1, 2, 3 etc.... so Enable in the second
column would be addressed as (1))

Now... say later... you decide that Item 71654 needs to enable thge button too. Then just
make that True in the table above, and your all ste to go. No need to reprogram the form
at all...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
E

evilcowstare via AccessMonster.com

Hi Al,
Thanks very much, thats a really REALLY handy piece of code!!!!!!
Its a hell of a lot easier to use.

Thank You !


Al said:
Evil,
Right Now, you have 4 values from the combo that would "enable" the button?
If so, there's a better solution, that will save you from having to reprogram the
enabling... if... in the future... more Items would cause "enabling"
Consider this example table to feed your combo selections...
Item Enable
1234-1 False
51420 True
13329 True
71654 False

Add Enable to your combo (say, the second colum) On the AfterUPdate event of the combo
(ex. cboItem)
If Me.cboItem.Column(1) = True Then
cmdButton.enabled = True
Else
cmdButton.enabled = False
End If
(Combo columns are numbered left to Right as 0, 1, 2, 3 etc.... so Enable in the second
column would be addressed as (1))

Now... say later... you decide that Item 71654 needs to enable thge button too. Then just
make that True in the table above, and your all ste to go. No need to reprogram the form
at all...
Hello Everyone,
[quoted text clipped - 13 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top