Need a code to fill 2 fields in a form with the user date and the

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I had a check control (yes/no) in the form to specify if a check was cashed.
This information is saved in a table. What I would like to do is have a code
in the click command to fill 2 fields with the user name and the time. The
reason is because the table could be used by different people and I need to
know who update the fields to report statistics of usage and work.

Do you think there is a way to do that? Click on the check box and retreive
the user and date into the fields.

Thanks!
 
username as in logged into the windows computer? in vba just use
ENVIRON("USERNAME") to capture the username and Now for the current
date and time, so in the onclick event of the check box use

Dim strSQL
strSQL = "INSERT INTO TABLE (username, timedate) VALUES( username = " &
"'" & ENVIRON("USERNAME") & "'" & ", timedate = " & "'" & Now & "'" &
")"
DoCmd.Run(strSQL)

this is an example of inserting just those fields, but im sure you get
it. Anyways, this should work, might be better ways of doing it though
 
Back
Top