1

Topic: Conditional formatting from the data of other table

I welcome;
There is a task:
It is required to select fields with color in the tape form which values coincide in other table.
For example: in the tape form there are records across the field (ID)
1267
4562
3876
1112
In other table there are records 4562 and 1112. Accordingly, it is necessary that in the tape form field ID changed color.
Added on the tape form an auxiliary field (lstID), and conditional formatting across the field (ID) referred to it, but the field changes color only in one record.
Probably somehow to organize this task program?

Private Sub Form_Load ()
Dim rs As ADODB.Recordset
Dim sql As String
Dim i As Integer
Dim str As String
' the Choice of the data for comparing
sql = "SELECT tbl_Current_Diagnos. ID_Tehniks" AND _
"FROM tbl_Current_Diagnos" AND _
"WHERE tbl_Current_Diagnos. Status =False"
Set rs = New ADODB.Recordset
rs. Open sql, CurrentProject. Connection, adOpenKeyset, adLockOptimistic
If rs. RecordCount <> 0 Then
rs. MoveLast
i = rs. RecordCount
' the Cycle is necessary
Debug. Print rs. Fields (0)
rs. MoveFirst
rs. Close
Set rs = Nothing
End Sub

2

Re: Conditional formatting from the data of other table

Add in the tape form a field with a sign of presence of record in other table (yes/is not present) and refer in conditional formatting to it. The sign is elementarily pulled out by request.
The resulted code did not understand. What for a cycle?

3

Re: Conditional formatting from the data of other table

MrShin;
Thanks for ))
So really is easier.
Thought a cycle to scan conterminous records.
The question is solved.