Add email VBA to existing code

C

Chad

Text_Network_User is pre filled in using a module to get thier PC Login. How
would I log whats in that text box before they get the pop up that they cant
enter the database? I gave up on the email thing! Sure would have ben nice
though...Thanks!
 
D

Douglas J. Steele

Dim strSQL As String

strSQL = "INSERT INTO LogTable(UserID, EventDtm, Comment) " & _
"VALUES(""" & Me.Text_Network_User & """, " & _
Format(Now(), "\#yyyy\-mm\-dd hh\:nn\:ss\#") & ", " & _
"Unauthorized Database Access" & ")"
CurrentDb.Execute strSQL, dbFailOnError

This assumes you have a table named LogTable with (at least) three fields:
UserID (a text field), EventDtm (a date/time field) and Comment (a text
field)
 
C

Chad

Could I add this to the code we have been working on? If so where in the code
would it go? Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top