yourdeployedson
Programmer
Below is my code. It works when I select option 1 or option two it changes my format conditions without a problem. However, I have to manually open the format conditions from the menu bar and click ok for it to actually take affect. I cant seem to make it active automatically. Can anyone help me?
Private Sub cmdChange_Click()
Dim objFrc As FormatCondition
Dim lngRed As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim lngYellow As Long
lngRed = RGB(255, 0, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
Me![txtResult].FormatConditions.Delete
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "LNE")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "CQ")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "Day Off")
Select Case cmdChange.Value
Case 1
With Me![txtResult].FormatConditions(0)
.BackColor = lngwhite
End With
With Me![txtResult].FormatConditions(1)
.BackColor = lngblack
End With
With Me![txtResult].FormatConditions(2)
.BackColor = lngyellow
End With
Case 2
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "DFAC")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "Day Off")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "CQ")
With Me![txtResult].FormatConditions(0)
.BackColor = lngRed
End With
With Me![txtResult].FormatConditions(1)
.BackColor = lngBlack
End With
With Me![txtResult].FormatConditions(2)
.BackColor = lngYellow
End With
End Select
End Sub
Private Sub cmdChange_Click()
Dim objFrc As FormatCondition
Dim lngRed As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim lngYellow As Long
lngRed = RGB(255, 0, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
Me![txtResult].FormatConditions.Delete
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "LNE")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "CQ")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "Day Off")
Select Case cmdChange.Value
Case 1
With Me![txtResult].FormatConditions(0)
.BackColor = lngwhite
End With
With Me![txtResult].FormatConditions(1)
.BackColor = lngblack
End With
With Me![txtResult].FormatConditions(2)
.BackColor = lngyellow
End With
Case 2
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "DFAC")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "Day Off")
Set objFrc = Me![txtResult].FormatConditions.Add(acFieldValue, acEqual, "CQ")
With Me![txtResult].FormatConditions(0)
.BackColor = lngRed
End With
With Me![txtResult].FormatConditions(1)
.BackColor = lngBlack
End With
With Me![txtResult].FormatConditions(2)
.BackColor = lngYellow
End With
End Select
End Sub