Hey both,
Thank you for the replies.
Code:
CurrentDb.Execute "INSERT INTO AuditDB (Date, UserName, formname, Action) VALUES (#" & datTimeCheck & "#, '" & StrLoginName & "', '" & Screen.ActiveForm.Name & "','Print');", dbFailOnError
I have added the code above to the VBA as follows:
Code:
'------------------------------------------------------------' CMDPrint_Click
'
'------------------------------------------------------------
Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err
DoCmd.RunCommand acCmdPrint
CurrentDb.Execute "INSERT INTO AuditDB (Date, UserName, formname, Action) VALUES (#" & datTimeCheck & "#, '" & StrLoginName & "', '" & Screen.ActiveForm.Name & "','Print');", dbFailOnError
cmdPrint_Click_Exit:
Exit Sub
cmdPrint_Click_Err:
Resume cmdPrint_Click_Exit
End Sub
But when i click 'Print, nothing is added to the table AuditDB.
I have the application (if you want to call it that) running as a 'program' so only what i have as the forms are displayed, there is no right click functionality and therefore would only be able to print via the 'print' button. There is of course the other way which would be to print screen.
The reason for the log is that the database will hold personal information that has been encrypted at both ends, so i wouldn't want people printing the info without it being logged.. Something for the GDPR rules!
Thank you, both, again. This has pointed me in the right direction, also will take a look at the likes for 'bad words'
Jase