|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
comparing two tables
how can i get a query or specific output dependent on data from two fields on one table to match data from two fields on a different table.
if a and b from table one match to c and d from table two, then some specific event happens, like a message stating success or the form turns yellow or something? |
|
#2
|
|||
|
|||
|
Quote:
Bit of a funny one but you could try a (rather inefficent) loop method. I had to do something similar... ----------------------------------------------- Dim db as Database dim tab1 as recordset dim tab2 as recordset dim results as string set db = currentdb Set tab1 = db.openrecordset("table1") Set tab2 = db.openrecordset("table2") With tab1 .MoveFirst Do until .EOF tab2.movefirst Do until tab2.EOF If .Fields("fieldA") = tab2.fields("fieldC") AND .Fields("fieldB") = tab2.fields("fieldD") then results = results & "Table 1, Record " & .fields("RecID") & " matches Table 2, Record " & tab2.fields("RecID") & vbCr End if tab2.moveNext Loop .movenext Loop End With msgbox results, vbInformation, "Results" ----------------------------------------------- |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > comparing two tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|