Updating edited records - please help

shaz123

Registered User.
Local time
Today, 03:03
Joined
Sep 8, 2006
Messages
81
I have two databases, were i have linked the second databse to a table in the first database. Within the seocnd database I have a table called tbl_Delupdate, i would like all the information form the first database table tbl_transactionmaster to be updated into tbl_Delupdate. I have tried the follwing half of it works in the sense that it updates all the information up2 "expiration required". Does not update "New status", "date of new status", "R status" and "Date of R Status"



"Dim db As DAO.Database
Dim strSQL As String
Dim strSQL2 As String
Dim strSQL16 As String
Dim te As DAO.Recordset
Dim te2 As DAO.Recordset

Set db = CurrentDb

strSQL = "SELECT * FROM tbl_TransactionMaster "

Set te = db.OpenRecordset(strSQL)


While Not te.EOF

strSQL2 = "SELECT * FROM tbl_Delupdate WHERE [Line Number] = '" & te![Line Number] & "' AND [Cylinder Number] = '" & te![Cylinder Number] & "' "
Set te2 = db.OpenRecordset(strSQL2)

If te2.EOF Then
strSQL16 = "INSERT INTO tbl_Delupdate ([Transaction Date],[Line Number],[Cylinder Number], [Works Order Number], ProdNo, CustNo, Status, [Customer Order Number], [Batch Number], [Expiration Required], [Health Hazard], [Cylinder Owner], [New Status],[Date of New Status], [R Status], [Date of R Status]) "
strSQL16 = strSQL16 & "VALUES ('" & te![Transaction Date] & "','" & te![Line Number] & "','" & te![Cylinder Number] & "','" & te![Works Order Number] & "','" & te![ProdNo] & "','" & te![CustNo] & "','" & te![status] & "','" & te![Customer Order Number] & "','" & te![Batch Number] & "','" & te![Expiration Required] & "','" & te![Health Hazard] & "', '" & te![Cylinder Owner] & "', '" & te![New Status] & "','" & te![Date of New Status] & "','" & te![R Status] & "','" & te![Date of R Status] & "')"
db.Execute (strSQL16)
End If

te2.Close
te.MoveNext
Wend

te.Close
db.Close

MsgBox "Syncronisation complete", vbInformation, "Successful"


End Sub"
 

Users who are viewing this thread

Back
Top Bottom