jevans
01-21-2001, 09:45 AM
What I need to do is update a transaction log table when a form is closed automatically. My table has the following fields: Transaction type and Date. I would like to enter text such as "Email Send" and use the current date as the date data. I need help thanks!!
In your OnClose event for the form you can do this:
Private Sub Form_Close()
Dim dbs as Database
Dim tdf as TableDef
Dim rst as RecordSet
Set dbs = CurrentDb ' or whatever DB you are working with
Set tdf = dbs.TableDefs"tblTransactionLog"
Set rst = tdf.openrecordset
with rst.
.addnew
!TransactionType = me.txtTransactionType
!TransactionDate = Now()
.update
end with
rst.close
dbs.close
Set rst = nothing
Set dbs = nothing
End Sub
ntp