C
Chris Nebinger
Okay, I read your first message before this one.
Replace it with CurrentDB.Execute
Or: DoCmd.RunSQL
Or: CurrentProject.Connection.Execute
Chris Nebinger
Boolean
Replace it with CurrentDB.Execute
Or: DoCmd.RunSQL
Or: CurrentProject.Connection.Execute
Chris Nebinger
String, sKeyField As String, lngKeyValue As Long) As-----Original Message-----
Hi there
I have the following code running as part of my Audit log script:
Function AuditDelBegin(sTable As String, sAudTmpTable As
Boolean
("tblInvoice", "audTmpInvoice", "InvoiceID", Me.InvoiceID)On Error GoTo Err_AuditDelBegin
'Purpose: Write a copy of the record to a tmp audit table.
' Copy to be written to real audit table in AfterDelConfirm.
'Arguments: sTable = name of table to be audited.
' sAudTmpTable = the name of the temp audit table.
' sKeyField = name of AutoNumber field in table.
' lngKeyValue = number in the AutoNumber field.
'Return: True if successful.
'Usage: Call from a form's Delete event. Example:
' Call AuditDelBegin
NetworkUserName() AS Expr3, " & sTable & ".* " & _'Note: Must also call AuditDelEnd in the form's AfterDelConfirm event.
Dim db As CurrentProject ' Current database
Dim sSQL As String ' Append query.
' Append record to the temp audit table.
Set db = DBEngine(0)(0)
sSQL = "INSERT INTO " & sAudTmpTable & " ( audType, audDate, audUser ) " & _
"SELECT 'Delete' AS Expr1, Now() AS Expr2,
sKeyField & " = " & lngKeyValue & ");""FROM " & sTable & " WHERE (" & sTable & "." &