Enabling Disabling Combo Boxes from Values

vdanelia

Registered User.
Local time
Yesterday, 23:09
Joined
Jan 29, 2011
Messages
215
Hello Dear friends, I have a question about Enabling Disabling Combo Boxes From 1 Combo Box Value.

I have 1 combo box [Warrtype] with values "Nowarranty, Year, Month, Day" I also have
1 Text Box [Warranty]
1 Text Box - Date/Time [Warroff]

I disabled both of the text boxes from the property sheet to disable.

If I choose from combo box the values "Year, Month, Days" the disabled combo boxes must be enabled, if i choose from combo box value "Nowarranty" all the text boxes must be locked again:
I did something like, but not working correctly....
I set the event procedure on combo box onEnter:

Select Case Me.WARRTYPE
Case "Year"
Case "Month"
Case "Day"
Me.Warranty.Enabled = True
Me.Warroff.Enabled = True
Case "Nowarranty"
Me.Warranty.Enabled = false
Me.Warroff.Enabled = false
End Select

Please correct my mistakes or suggest the best variant...

Thank you in advanced
 
Try the following code in the AfterUpdate event of your combo box:
Code:
If Me.WARRTYPE = "Nowarranty"
     Me.Warranty.Enabled = False
     Me.Warroff.Enabled = False
Else
     Me.Warranty.Enabled = True
     Me.Warroff.Enabled = True
End If
 
It says error: In the editor it's red
 
As to your code
Code:
Select Case Me.WARRTYPE
Case "Year"
Case "Month"
Case "Day"
Me.Warranty.Enabled = True
Me.Warroff.Enabled = True
needs to be
Code:
Select Case Me.WARRTYPE
Case "Year", "Month", "Day"
Me.Warranty.Enabled = True
Me.Warroff.Enabled = True
Linq ;0)>
 
Is one of the lines highlighted? If so, which one.

You might try Missinglinq's suggestion.
 
"If Me.WARRTYPE = "Nowarranty" is highlighted in red
 
This makes it seem as though the value return by your combo box is not "Nowarranty".

Did you try Missinglinq's suggestion to see if it will work?
 
Can you post you database here so I can see how to try to help you?
 
I have attached a modified version of your file. I have fixed your combo box and it now enables or disables the text box controls.

Have a look at the code in the AfterUpdate event of the combo box.

I have some notes there to explain some of the changes I made.
 

Attachments

Users who are viewing this thread

Back
Top Bottom