[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1111
  • Last Modified:

FormatConditions backcolor help

Can anybody give insight on this.. The following vba codition works correctly EXCEPT for the backcolor of the text field.. the result of Any rgb changes the backcolor result is Black. When I shut off the conditionns the backcolor goes back to white but when clicking my condition button the Forecolors work (blue,pink,purple) but the background color stay at black.. I wanted it yellow RGB(255, 255, 0)..

----------------------------------------------------------------------
Dim fcd1 As FormatCondition

If Me.Contact1First.FormatConditions.Count > 0 Then
MsgBox "Conditional format already exists."
Exit Sub
End If

Set fcd1 = Me.Contact1First.FormatConditions.Add(acExpression, acEqual, "Date()>=[trialstartdate] And Date()<=[trialenddate] And [contractstatus]='Unsigned'")
Set fcd1 = Me.Contact1First.FormatConditions.Add(acExpression, acEqual, "date() > [TrialEndDate] And [ContractStatus] = 'Unsigned'")
Set fcd1 = Me.Contact1First.FormatConditions.Add(acExpression, acEqual, "[contractstatus]='signed' Or [contractstatus]='N/A'")

With Me![Contact1First].FormatConditions(2)
    .FontBold = True
    .FontItalic = True
    .FontUnderline = False
    .BackColor = True
End With

Me.Contact1First.FormatConditions(0).ForeColor = RGB(72, 61, 139)
Me.Contact1First.FormatConditions(0).FontBold = True
Me.Contact1First.FormatConditions(0).BackColor = RGB(255, 255, 0)
Me.Contact1First.FormatConditions(0).BackColor = True


Me.Contact1First.FormatConditions(1).ForeColor = RGB(255, 62, 150)
Me.Contact1First.FormatConditions(1).FontBold = True
Me.Contact1First.FormatConditions(1).BackColor = RGB(255, 255, 0)
Me.Contact1First.FormatConditions(1).BackColor = True


Me.Contact1First.FormatConditions(2).ForeColor = RGB(255, 0, 255)
Me.Contact1First.FormatConditions(2).FontBold = True
Me.Contact1First.FormatConditions(2).BackColor = RGB(255, 255, 0)
Me.Contact1First.FormatConditions(2).BackColor = True
0
joein610
Asked:
joein610
  • 2
  • 2
1 Solution
 
TheSloathCommented:
You're setting the backcolor twice?

Me.Contact1First.FormatConditions(1).BackColor = RGB(255, 255, 0)
Me.Contact1First.FormatConditions(1).BackColor = True


...and ultimately to -1
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
What happens if you remove the lines:

Me.Contact1First.FormatConditions(0).BackColor = True

?

mx
0
 
joein610Author Commented:
Ahh THANX@!!!

For the first time I spent the time to incease my conditions and I got fouled up..

0
 
joein610Author Commented:
I guess access even through code has a 3 condition limit??
0
 
TheSloathCommented:
Yeah - annoying isn't it :-)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now