Date Color Change and Toggle Forms

TClark14

Registered User.
Local time
Today, 20:11
Joined
Sep 28, 2001
Messages
85
I am wondering of there is a code to change the color in a date field to display a different color if the date is a weekend. If so, would the date field need to be set to Long Date in order to work?

Another question, Is there a code I can put on a button to toggle between two forms that are both open rather than toggling using CTL Tab?

Thanks
Terry
 
The answer to your second question is to put code like this in the On Click event of a Command button:

[Forms]![FormName].SetFocus

'FormName' is the form that currently is not showing but is open.
 
For your Date question .... have a look at the Weekday() function in Access Help. You can use this to determine the day of the week from the date entry.

HTH
RDH
 
Here is an answer to your first question... In the On Current event of your form put code similar to this:

Private Sub Form_Current()
If Format(YourDateField, "ddd") = "Sun" Or _
Format(YourDateField, "ddd") = "Sat" Then
Me.YourDateField.ForeColor = 255
Else
Me.YourDateField.ForeColor = 0
End If
End Sub

You could also but the code in the After Update event of the date field so when the date is entered it will turn red if the date is a Saturday or Sunday....

[This message has been edited by Jack Cowley (edited 11-18-2001).]
 

Users who are viewing this thread

Back
Top Bottom