Background or font colors in forms (Access 97)

gtford

Registered User.
Local time
Today, 04:40
Joined
Apr 3, 2002
Messages
16
Earlier in month I posted the following: I have a "to do" task list which includes a DueDate for completion of the task. I want to design the form so that when it's opened any past due tasks (Task) are emphasized by red fonts.

Jerry Stoner posted in response: In the forms current event:
If Me.YourControlName < Date() Then
Me.YourControlName.ForeColor = 255
End If

I inserted in the form current event:
If Me.DueDate <Date() Then
Me.Task.ForeColor = 255
End If

What's happening is that all of the tasks turn red, even when the DueDate is greater than the current date.

My formats all seem in order. I'm stumped.

Any ideas would be appreciated. Thanks.
 
Are you in single form view or continous forms? The code I gave works for single view only. I have Access 2000 and rely on conditional formatting for continous forms so I cant help you if thats what you are doing.Anyone else have an idea??
 
Thanks for your reply Jerry. Yes I am using continuous forms view. Single form doesn't work because the employees have to be able to view all of their outstanding tasks including the past due tasks.

Maybe someone else will have a solution.
 
You have to cheat in 97 by overlaying the same number of textboxes as you want conditions for, set the font colour for each on the property sheet, set the control source =Iif([MyDatefield]<Date(),[MyDateField],"") get the idea?
 
You should add an Else statement to set the colors back to a default color.

If (Eval("[Forms]![frmSomething]![txtSomething] < something")) Then
txtSomething.ForeColor = 255

Else
txtSomething.ForeColor = 0
End If

I haven't tested this in "Continous Forms" but it should work.

[This message has been edited by bbeeching (edited 05-01-2002).]
 
Sorry bbeeching but I tried that before I replied. gtford will have to follow Rich's post to get what he/she wants.
 
Rich, thanks for your reply. Hate to sound dumb, but I'm not certain I know how to overlay a textbox. Let's say I only want the condition to apply to my "Text" field. Do you mean in design view I move a new textbox over the existing "Text" field and insert the font colour and then the Iif statement in the control source of the new text field? When I did that and viewed the records, I get a #Name? error in the "Text" field. I must be doing something wrong.

Thanks again.
 
Rich, sorry, I didn't notice the obvious - I didn't insert the = sign in the formula.

This now gives me all of my "Tasks" in red up to current date and then from current date forward the "Task" fields are blank. I need for the task fields to be reflected from current date forward, but in a different font color.

I'll post back if I'm successful.

Thanks again.
 
Please refer to Rich's post above.

This method works, but I want all records to be reflected. The records where the
[DueDate]<Date()will have the [Task] field ForeColor=255. The records where the [DueDate]=>Date() will have the [Task] field ForeColor=0.

I'm not certain how to incorporate this into the Iif statement.
 
You have two text boxes, set the colours for each on their respective property sheets, the control source for the first =Iif([DueDate]<Date(),[DueDate],"") the second one =Iif([DueDate]>=Date(),[DueDate],"")
 
Thanks, Rich. It's starting to sink in. Can you explain exactly how to overlay the two text boxes over the DueDate text box - I don't think I'm doing it correctly. I set up the two text boxes and if I overlay one over the other, the one on top is the one controlling the condition.

If I overlay one of the text boxes over the DueDate text box and place the second text box under the DueDate, then the DueDate is reflected in red if less than current date and then the DueDate is reflected in the lower box in black on or after current date.

Do I have to separate the two text boxes for this to work, or am I not understanding how to overlay the text boxes?

Thank you for your patience!
 
Rich, I just figured it out. I needed to make the top text box overlay transparent so when the condition changed I could view the second text box. I works perfectly.

Thanks so much for your help.
 

Users who are viewing this thread

Back
Top Bottom