I thought I had it sorted but after following the example I have something wrong. I have not worked with recordsets as I am new to VBA.
the code given I have adjusted and ended up with this:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("TblInventoryUpdateAudit", dbOpenDynaset)
rs.AddNew
'rs!sCurrentUser = CurrentUser 'a system function
rs!InventoryChange = Me![Txtupdateinventory]
rs!dtCreated = Now()
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
If I comment out this line:
rs!InventoryChange = Me![Txtupdateinventory]
It works, Where have I gone wrong?
I get the error"Item not found in this collection"
Help Please!
the code given I have adjusted and ended up with this:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("TblInventoryUpdateAudit", dbOpenDynaset)
rs.AddNew
'rs!sCurrentUser = CurrentUser 'a system function
rs!InventoryChange = Me![Txtupdateinventory]
rs!dtCreated = Now()
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
If I comment out this line:
rs!InventoryChange = Me![Txtupdateinventory]
It works, Where have I gone wrong?
I get the error"Item not found in this collection"
Help Please!