Conditional format?

  • Thread starter Thread starter Sparks
  • Start date Start date
S

Sparks

Guest
I just started using Access and trying to get over this learning curve- Want to know on my form if I have Date Rcvd and Date Accepted fields how to show records as a diff color if Date accepted is empty (meaning the proposal hasn't gone thru yet)? Thanks in advance for any help.
 
Unfortunately, I haven't found conditional formatting to be an easy thing in Access. In fact, depending on the situation, it's sometimes not available at all on a per record basis. For example, you can write some vba code to do conditional formatting on a Single Form, but NOT on a Continuous form b/c any format changes you apply on a Cont. Form w/ VBA apply to all records on the form, not just the current record.

On a single form, you can do some conditional formatting. You can use the OnCurrent event of the form to check the condition of a control, etc. and make formatting changes based on the results. In your case, the code might look like:

------------
Private Sub Form_Current()
If IsNull([Date Accepted]) Then
Me.[Date Rcvd].ForeColor = 255
Else
Me.[Date Rcvd].ForeColor = 0
End If
End Sub
------------

The OnCurrent event fires each time the record changes. Therefore, each time you switch records, this subroutine checks to see if Date Accepted is null and if so it changes Date Rcvd to RED (255 is the value for red). If it's not null, it changes it to black. You could change any of the other controls or properties in a similar fashion.

It's not great, but it's conditional formatting! Let me know if you have more questions.

js


[This message has been edited by jstutz (edited 07-24-2001).]
 
Here is a demo of how to do conditional formatting in a continuous form without actually using the built-in conditional formatting functions (so it also works in A97).

[This message has been edited by Mike Gurman (edited 07-25-2001).]
 
Wow Mike... that's cool! You learn something new every day. Thanks for sharing that... I will have to add that to my "bag of tricks!"

jamie
 
js thanks for the help! went out of town unexpectedly-just tried it and it worked
smile.gif

and mike thanks for the demo
 

Users who are viewing this thread

Back
Top Bottom