I want to insert some values into a table but cant get the syntax right. I have four fields in the table:
Date, Time, User, Action
When a user logs in, I want it to insert the date, time, the username and action performed. The username I get from another script.
So I declare the variables:
Dim dateis, timeis, useris, actionis
dateis = date ' this is a date field
timeis = time ' this is a time field
useris = username ' text field
actionis = "User has logged in"
Then do the insert bit:
docmd.runsql "INSERT INTO T_Audit (Date,Time,User,Action) VALUES (dateis,timeis,useris,actionis);"
But keep getting syntax error. I know its something to do with the VALUES section, have tried quotes etc but cant get it right.... help!
Date, Time, User, Action
When a user logs in, I want it to insert the date, time, the username and action performed. The username I get from another script.
So I declare the variables:
Dim dateis, timeis, useris, actionis
dateis = date ' this is a date field
timeis = time ' this is a time field
useris = username ' text field
actionis = "User has logged in"
Then do the insert bit:
docmd.runsql "INSERT INTO T_Audit (Date,Time,User,Action) VALUES (dateis,timeis,useris,actionis);"
But keep getting syntax error. I know its something to do with the VALUES section, have tried quotes etc but cant get it right.... help!