Conditional Formatting Problem #Name?

R

rm

For a report that displays various Information including a dollar
amount.. any and all attempts (through the Access interface or
programmatically) ti apply conditioal formatting results in the the
Dollar amont being displayed as "#Name?" When the Conditional
formatting is removed the data is displayed as expected.

Also - all other fields in the report are displayed as expected.

I had a sneaking suspicion that Access can't handle a reference to
another field if the both are numeric. So I tried Cstr() on the value.
But that did not work.

(by the way I picked this up from the book "Programming Microsoft
Office Access 2003 (Core Reference) ", by Rick Dobson , Microsoft
Press © 2003" - but I had to look at the object model through the
locals window to figure out how to make this work.)


Private Sub Report_Open(Cancel As Integer)

Dim frc1 As FormatCondition
Dim frc2 As FormatCondition
Dim frc3 As FormatCondition
Dim frc4 As FormatCondition
Dim frc5 As FormatCondition
Dim frc6 As FormatCondition

Dim intTop As Integer

Call cleanUpFRCs

'Prompt user to enter number of priority items
intTop = CInt(InputBox("Enter the number or priority Items?",
"fldPriority", 5))

'fldPriority
'Condition for values greater than or equal to criterion;
Set frc1 =
Me.Controls("fldPriority").FormatConditions.Add(acFieldValue,
acLessThanOrEqual, intTop)
frc1.FontBold = True
frc1.BackColor = RGB(211, 211, 211)

'fldPPR_PPE
'Condition for values greater than or equal to criterion;
Set frc2 =
Me.Controls("fldPPR_PPE").FormatConditions.Add(acExpression,
acLessThanOrEqual, "[fldPriority] <= " & CStr(intTop))
frc2.FontBold = True
frc2.BackColor = RGB(211, 211, 211)
'
''fldContractName
'Condition for values greater than or equal to criterion;
Set frc3 =
Me.Controls("fldContractName").FormatConditions.Add(acExpression,
acLessThanOrEqual, "[fldPriority] <= " & CStr(intTop))
frc3.FontBold = True
frc3.BackColor = RGB(211, 211, 211)
'
''fldDollarAmt - Problem Here
'Condition for values greater than or equal to criterion;
Set frc4 =
Me.Controls("fldDollarAmt").FormatConditions.Add(acExpression,
acLessThanOrEqual, "[fldPriority] <= " & CStr(intTop))
frc4.FontBold = True
frc4.BackColor = RGB(211, 211, 211)

''fldDescription
'Condition for values greater than or equal to criterion;
Set frc5 =
Me.Controls("fldDescription").FormatConditions.Add(acExpression,
acLessThanOrEqual, "[fldPriority] <= " & CStr(intTop))
frc5.FontBold = True
frc5.BackColor = RGB(211, 211, 211)
'
''txtFiller
'Condition for values greater than or equal to criterion;
Set frc6 =
Me.Controls("fldFiller").FormatConditions.Add(acExpression,
acLessThanOrEqual, "[fldPriority] <= " & CStr(intTop))
frc6.FontBold = True
frc6.BackColor = RGB(211, 211, 211)

'Clean up objects
Set frc1 = Nothing
Set frc2 = Nothing
Set frc3 = Nothing
Set frc4 = Nothing
Set frc5 = Nothing
Set frc6 = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top