Conditional formatting within form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm just trying to build some confiditional formatting within a form.
Basically if field 1 =x then field 2 back color should change and allow input
else, it shouldn't allow any data entry.. Here is the code that I'm using ...
I get no error message but it just doesn't work...

Thanks so much in advance,
Kanga

Private Sub Revenue_recognized_or_Reversal_reason_AfterUpdate(

If Me.Revenue_recognized_or_Reversal_reason = "Sale and lease back" Then
Me.Contract_Start_Date.Locked = False And Me.Contract_Duration.Locked = False
And Me.Amortization.Locked = False And Me.Contract_Start_Date.BackColor =
52479 And Contract_Duration.BackColor = 52479 And Me.Amortization.BackColor =
52479 Else If Me.Revenue_recognized_or_Reversal_reason = "Extended Warranty"
Then Me.Contract_Start_Date.Locked = False And Me.Contract_Duration.Locked =
False And Me.Amortization.Locked = False And Me.Contract_Start_Date.BackColor
= 52479 And Me.Contract_Duration.BackColor = 52479 And
Me.Amortization.BackColor = 52479 Else: Me.Contract_Start_Date.Locked = True
And Me.Contract_Duration.Locked = True And Me.Amortization.Locked = True

End Sub
 
is the value you're testing for really "Sale and lease back" and "Extended
Warranty"? if these values are being entered in a combo box on the form,
it's possible that they're the "display" values, not the values being saved
in the table - especially if you put a Lookup field in the table.

btw, if you're using A2000 or newer, you might find it easier to use
Conditional Formatting on the Format menu in form design view.

hth
 
Back
Top