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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-setting dateField backcolor 1

Status
Not open for further replies.

BabyPowder2u

Programmer
May 4, 2005
87
US
I have a pop-up calender triggered by several cbodate fields. One of those fields is checked to verify it has a value. If it doesn't contain a date the backcolor is changed to yellow. This works fine. What I want is for the field to return to original color if a date is entered.

I have tried:

Private Sub cboDtSubmitted_Change()
cboDtSubmitted.BackColor = 16777215
End Sub
'this produced no change

Private Sub ocxCalendar_Updated(Code As Integer)
cboOriginator.BackColor = 16777215

End Sub
' This produced no change

My calendar & cbo routines are:

Private Sub cboDtSubmitted_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Set cboOriginator = cboDtSubmitted
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub

Private Sub ocxCalendar_Click()
cboOriginator.Value = ocxCalendar.Value
cboOriginator.SetFocus
ocxCalendar.Visible = False
Set cboOriginator = Nothing
End Sub

Any help would be appreciated.

Thanks,
T
 
If it doesn't contain a date the backcolor is changed to yellow
How you do that ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
BabyPowder2u
Here is some code from a book that you can probably modify to suit your purposes...

Code:
Private Sub Form_Current()
   If Date - [DueDate] > 30 Then
      'Make control background opaque
   DueDate.BackStyle = 1
      'Make control background white
   DueDate.BackColor = vbWhite
      'Make font color red
   DueDate.ForeColor = vbRed
Else
      'Make control background transparent
   DueDEate.BackStyle = 1
      'Make font color black
   DueDate.ForeColor = vbBlack
End If
End Sub

Tom
 
I have a cmdbtn to run a report. Before the report runs it checks specific fields for values. If fields are null then I set the fields which are missing to yellow, set focus to the first missing field & exit sub:

cboDtSubmitted.BackColor = 8454143
 
I found it:

there was sub ocxCalendar_Click(). I inserted the backcolor change there.
:
:
Private Sub ocxCalendar_Click()
cboOriginator.Value = ocxCalendar.Value
cboOriginator.SetFocus
cboOriginator.BackColor = 16777215
ocxCalendar.Visible = False
Set cboOriginator = Nothing
End Sub

Thanks for the help.
T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top