If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Conditional format a Null Date
Conditional formatting doesnt seem to work for a null date.
I want a DateCompleted control to turn red if there is a Null date. maybe something like on current ifnull.date Backcolor = VBred ??? new to VB and cant seem to get anything to work Any Ideas appreciated.. |
#2
|
|||
|
|||
Conditional format a Null Date
Conditional formatting will work, but has to be on the basis of an expression
not the value of the field. This is because Null is not a value, but the absence of a value so nothing can = Null, not even Null. The result is always Null. However, the IsNull function can be used in an expression. In the conditional formatting dialogue for the control in question use: Expression is……….IsNull([YourDateField]) or alternatively: Expression is……….[YourDateField] Is Null The square brackets around the field name are essential. If you omit them the field name will be treated as a literal string, so the IsNull function will never evaluate to True. BTW if you've called your field Date I'd strongly recommend you change it to something more specific such as TransactionDate, AppointmentDate or whatever suits. Date is the name of a built in function so is best avoided for object names. It would be possible to do it in code in the form's Current event procedure, but only if the form is in single form view as, in continuous form view the colour of the control in every row would change. Conditional formatting works in single form, continuous form or datasheet view. Ken Sheridan Stafford, England "Barry A&P" wrote: Conditional formatting doesnt seem to work for a null date. I want a DateCompleted control to turn red if there is a Null date. maybe something like on current ifnull.date Backcolor = VBred ??? new to VB and cant seem to get anything to work Any Ideas appreciated.. |
Thread Tools | |
Display Modes | |
|
|