I have a database called "Vendor" in which I need to track who has 'clicked' buttons to perform an event. The table is called "Audit Log" and I'm stuck on how to write the code to insert into a table. Here's what I have so far but I'm having issues on the "Insert" function. Can you help? I've "borrowed" the code and am not able to figure out how to troubleshoot. Thanks in advance!
Private Sub Command505_Click()
Dim strLocation As String
Dim db As DAO.Database
Dim sql As String
Set db = CurrentDb()
Me.Modified_by = Environ("USERNAME")
Me.Modified_on = Format(Now(), "yyyy-MM-dd hh:mm:ss")
sql = "Insert into AuditLog Values('" & Modified_by & "', '" & Modified_on & "', '" "NegativeBalance"');"
db.Execute sql
End Sub
Private Sub Command505_Click()
Dim strLocation As String
Dim db As DAO.Database
Dim sql As String
Set db = CurrentDb()
Me.Modified_by = Environ("USERNAME")
Me.Modified_on = Format(Now(), "yyyy-MM-dd hh:mm:ss")
sql = "Insert into AuditLog Values('" & Modified_by & "', '" & Modified_on & "', '" "NegativeBalance"');"
db.Execute sql
End Sub