compare one record with several others

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jollycottage
    New Member
    • Nov 2008
    • 2

    compare one record with several others

    Please can anyone help? I have several recordsets containing the same number of records and each record having 2 fields. One recordset being the primary the others secondary. I what to compare Primary Record 1 Field 1 with all other secondary record 1's and field 1's then colour secondary Field 1 bgcolor as red if not equal until it reaching eof of each secondary recordset and then eof of the Primary recordset and so on. Example below:

    Primary Sec1 Sec2 Sec3 Sec 4 Sec5 Sec6
    2 4 2 6 2 4 2 3 2 4 2 5 2 4
    2 3 2 4 2 3 4 3 4 4 2 4 2 6
    ...
    ...
    ...

    Any help would be most appreciated.
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    just create 3 instances of ado recordset and use a nested loop.

    Comment

    • jollycottage
      New Member
      • Nov 2008
      • 2

      #3
      I have created ADO rs and can display the records, but need help on the netsed loops. Is it worth while creating a nested loop with just the Primary and one other Secondary Record? Example would be most helpful.

      Comment

      • iam_clint
        Recognized Expert Top Contributor
        • Jul 2006
        • 1207

        #4
        Alright first of all I need to know exactly what you are going after, can this just be done in the sql statement itself?

        Comment

        • iam_clint
          Recognized Expert Top Contributor
          • Jul 2006
          • 1207

          #5
          SQL Example of what you are wanting

          select id from tbl1
          where id in (select id from tbl2)
          and id in (select id from tbl3)

          Comment

          Working...