Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date question

Status
Not open for further replies.

kpryan

Technical User
Aug 24, 2005
282
US
Hi,
Is it possible when a date reaches a certain date that the background colour can change?

many thanks,

KP
 

I'm afraid you're going to have to make it a little clearer exactly what you mean by "when a date reaches a certain date." It might also help to know what version of Access you're running.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Sure.
Something like this in the forms open event...
Code:
Private Sub Form_Open(Cancel As Integer)
    If Date >= #11/20/2007# Then
        Me.Detail.BackColor = vbBlue
        Me.FormFooter.BackColor = vbBlue
        Me.FormHeader.BackColor = vbBlue
    Else
        Me.Detail.BackColor = vbGreen
        Me.FormFooter.BackColor = vbGreen
        Me.FormHeader.BackColor = vbGreen
    End If
End Sub

Randy
 
Many thanks missingling,
for your reply. I'm using Access 2002
I have a staff planner system.
When the date reaches a public hloiday I want the dates background to change colour so that our co ordinator will not allcoate staff work on this day.


Regards,

KP
 
Hi Randy700,

Many thanks for your help it works, but the date format want to do it in USA. When I change it to the Australian Format it changes back to USA. In the computer setup it is set for Australia.

Is there a reaon why this sholud happen in MS access?

KP
 

VBA expects dates and decimal point to be in US. To bypass that, use the DateSerial function that always returns a well accepted date value.

Something
If Date >= DateSerial(2007, 11, 14)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top