Full Version: Conditional Formatting
UtterAccess Forums > Microsoft® Access > Access Forms
Access_Nu_bee
Hello, from a "newbie". I hope this is a simple fix.

I am trying to create a conditional format for a calculated field in a form.

The field calculates how many days a project is open for. I have another field on this form, that denotes the project status: "Open" "Open, High-Priority" and "Closed".

I have successfully formatted this field to show if the open number of project days exceeds or meets a prescribed project timeline. The problem, is when a project is closed, I want this field to "grey out". It will eventually take on a conditional format that I created to show when a project exceeds the prescribed number of days, even when it's closed. I have toyed around with a few expressions, to no avail. Essentially, when the project status is set to "Closed", I am trying to have it "grey out" so it does not create confusion, implying it has exceeded a prescribed deadline. Any and all help is greatly appreciated!
River59
When the condition is met, disable the field :

If "My condition is met", Then
Me.Myfield.enabled = False
End IF
azolder
Add another condition before all others and format the textbox as desired. You'd probably use an expression something like [Status]=3, assuming 3 is the fk value for the closed status.
Access_Nu_bee
Am I doing that in Visual Basic? (Please excuse my ignorance)

Would that be in the Event Procedure? If so, would it be "on click" "before" or "after" update?

Here was my attempt, but it's still not working:

Option Compare Database

Private Sub Box67_Click()

End Sub

Private Sub Command68_Click()

End Sub

Private Sub Command69_DblClick(Cancel As Integer)

End Sub

Private Sub Current_PALT_AfterUpdate()
Me.Myfield.Enabled = False
End If


Private Sub Current_PALT_Change()
Me.Status.Enabled = False
End If
End Sub

Thanks for your help!
Access_Nu_bee
I tried that, but it still doesn't work. It still doesn't want to recognize a grayed out format, even when that is the first condition: (per attached)


Thanks for your help!
tina t
in earlier (.mdb) versions of Access, format condition one would not be "Value =". you would choose the option to use an expression, and enter the expression in the space provided. A2010 may be different, but suggest you look at the conditional formatting options to see if it offers something like "Expression is". also, if field PALT is a Number data type, then the zero (0) in your expression should not be enclosed in double quotes - it would be typed without any quotes.

hth
tina
RJD
Hi: Just to confirm tina's suggestion, in A2010 you should be using Expression Is in the first rule rather than Field Value Is. Also, good point about the zero number vs text. See if what tina suggested works for you.

HTH
Joe

(And Hi tina!)
Access_Nu_bee
Tina & RJD:

Thank you, that worked perfectly smile.gif
tina t
hi Joe! <waves enthusiastically> nice to see you, and thanks for confirming how it works in A2010 - i'm often at a disadvantage with my older versions. :)

@Access_Nu_bee
you're welcome, Joe and i are glad to help! :)

tina
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.