PC User
Registered User.
- Local time
- Today, 11:37
- Joined
- Jul 28, 2002
- Messages
- 193
I'm trying to update a record in one table from data in a record from another table using a common field (ChemicalID). I don't get any errors, but the code is not udating the target table. Can someone help?
Thanks,
PC
Code:
Public Function UpdateInventory()
'On Error Resume Next
On Error GoTo Whoops
Dim Db As DAO.Database
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Set Db = CurrentDb()
Set rst1 = Db.OpenRecordset("tblChemicalInventory", dbOpenDynaset) 'From insert data notification
Set rst2 = Db.OpenRecordset("tblChemicalProperties", dbOpenDynaset) 'From insert data notification
rst2.FindFirst [ChemicalID] = gintChemicalID
With rst1
.Edit
![CAS] = rst2!CAS
![Fire Code Hazard Classes] = rst2![Fire Code Hazard Classes]
![Hazardous Material Type] = rst2![Hazardous Material Type]
![Physical State] = rst2![Physical State]
![Storage Pressure] = rst2![Storage Pressure]
![Storage Temperature] = rst2![Storage Temperature]
![Units] = rst2![Units]
![Storage Container] = rst2![Storage Container]
![Fed Hazard Catagory] = rst2![Fed Hazard Catagory]
![DOT No] = rst2![DOT No]
![Hazard Class/Division] = rst2![Hazard Class/Division]
![Usage Purpose] = rst2![Usage Purpose]
![NFPA ID Health] = rst2![NFPA ID Health]
![NFPA ID Reactivity] = rst2![NFPA ID Reactivity]
![NFPA ID Flamability] = rst2![NFPA ID Flamability]
![NFPA ID Special Hazard] = rst2![NFPA ID Special Hazard]
.Update
End With
rst2.Close
Set rst2 = Nothing
rst1.Close
Set rst1 = Nothing
Db.Close
Set Db = Nothing
OffRamp:
Exit Function
Whoops:
MsgBox "Error #" & Err & ": " & Err.Description
Resume OffRamp
End Function
PC