Help saving data from a form

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.
 
A

Allen Browne

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
 
G

Guest

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.




.
 

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