Help saving data from a form

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

I want to keep a log of users who access a database. I
created a login table and then a form based on it. I set
the fields in the form to automatically capture the
Date/Time, User Name and Computer Name. The problem is
Access won't save this as a new record unless data is
typed in manually. Any ideas.

Thanks for any help.
 
Use an Append query statement to automatically add a record to your log
table:

Dim strSQL as String
strSQL = "INSERT INTO ...
dbEngine(0)(0).Execute strSQL, dbFailOnError

If you are not sure how to get the string for the SQL statement, mock one up
in the query grid, switch to SQL View (View menu), and copy what you see.

If you are not sure how to get the network user name or computer name, see:
http://www.mvps.org/access/api/api0008.htm
http://www.mvps.org/access/api/api0009.htm
 
Thanks,

I'll Give it at try.
-----Original Message-----
Use an Append query statement to automatically add a record to your log
table:

Dim strSQL as String
strSQL = "INSERT INTO ...
dbEngine(0)(0).Execute strSQL, dbFailOnError

If you are not sure how to get the string for the SQL statement, mock one up
in the query grid, switch to SQL View (View menu), and copy what you see.

If you are not sure how to get the network user name or computer name, see:
http://www.mvps.org/access/api/api0008.htm
http://www.mvps.org/access/api/api0009.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top