I already answered this in your other post:
I have only used conditional formatting in Reports. Never tried to use it on Forms.
My first instinct would be to write code to:
1. Open a recordset and loop through it looking for your matching data in the appropriate field.
It looks something like this - but you'll have to fill in real logic:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
With rs
Do While Not rs.EOF
'Do your processing here. Eg:
'Get the value in the field you are searching in the current record.
strValueFromDB = rs![FieldName]
'Compare value on form with field name to see if there's a match.
If strValueFromDB = Me.ControlNameOnForm Then
'Code to change BackColor to Green
'Match found - so Close up shop & Exit.
End If
.MoveNext 'Move to next row of data
Loop
End With
rs.Close
Set db = Nothing
** This is just guidelines - not fully operational code.
2. If a match is found, then change the BackColor property of the textbox to green.
Usually, if you type in 'Me.ControlName.' - as soon as you type in the last dot, Access will drop down a list of properties that you can modify for that control. Scroll through the list and find BackColor. You should end up with something like Me.ControlName.BackColor = vbGreen
3. If no match is found, then change the BackColor property of the textbox to red.
I hope this gives you a starting point.