J
jw rutgers
I have an Access form where, in the current record, I want a field which has
a duplicate in other records to color red.
I've tried conditional format but that doesn't seem to work. I found out
that I can let a msgbox appear when such duplicates occur.
But when I try to color the field, instead of coloring only the field in the
current record, Access colors the field in all the records.
Is there a way in which I can let only the field in the current record take
the color red?
I use the following code:
Private Sub Form_Current()
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
If ((DCount("[comp]", "deal1", "[comp] ='" & Me!comp & "'"))) >=2 then
Me![comp].BorderColor = lngRed
Me![comp].ForeColor = lngRed
Me![comp].BackColor = lngYellow
Me![comp].SetFocus
End If
End Sub
Thanks!,
JW
a duplicate in other records to color red.
I've tried conditional format but that doesn't seem to work. I found out
that I can let a msgbox appear when such duplicates occur.
But when I try to color the field, instead of coloring only the field in the
current record, Access colors the field in all the records.
Is there a way in which I can let only the field in the current record take
the color red?
I use the following code:
Private Sub Form_Current()
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
If ((DCount("[comp]", "deal1", "[comp] ='" & Me!comp & "'"))) >=2 then
Me![comp].BorderColor = lngRed
Me![comp].ForeColor = lngRed
Me![comp].BackColor = lngYellow
Me![comp].SetFocus
End If
End Sub
Thanks!,
JW