That's a big question. What criteria define which records the value is assigned to, how are the tables related etc? Basically you should open a recordset according to a query which combines the two tables and you could then use SQL to assign the value(s). But exactly how this is done depends on the relationship between the table sand how you choose what values go where etc. Have fun! )
I believe what you need to do is to use a DAO.Recordset to open each table, then using DAO methods synchronize them and perform your assignments.
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim strSQL As String
Dim strCriteria As String
strSQL = "Your SQL here"
Set rst1 = CurrentDb.OpenRecordset(strSQL)
strSQL = "Your new SQL here:
Set rst2 = CurrentDb.OpenRecordset(strSQL)
If rst1.RecordCount <> 0 Then
rst1.MoveFirst
Else
MsgBox "No data found."
GoTo Exit_Proc
End If
If rst2.RecordCount <> 0 Then
rst2.MoveFirst
Else
MsgBox "No data found."
GoTo Exit_Proc
End If
Do While Not rst1.EOF
strCriteria = "ID = '" & NHA & "'"
rst2.FindFirst strCriteria
LookForMore:
If Not rst2.NoMatch Then
' Do your assignment thing here
Else
' Maybe write something out to a log file
' about this no match condition
' Maybe even continue to find matches
' rst1.FindNext strCriteria
' GoTo LookForMore
End If
DoEvents
rst1.MoveNext
Loop
----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.