Solved

Writing a record to a table.

Posted on 2016-09-20
2
46 Views
Last Modified: 2016-09-20
I have a bunch of tables with various bits of information and status updates on them but what I want to do is create a table called tbl_StatusUpdates and need some help writing the code to record the update of a status.

For example on Form 1 I have one field called Status.


Every time someone updates this field, I want in the tbl_status table to record, the name of the status, the date the record was updated and the Environ("User") of the person.

I think it should be pretty easy but I'm not sure how to go to table create a new record and then add these three pieces of data, any ideas?
0
Comment
Question by:mtrussell
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
Eric Sherman earned 500 total points
ID: 41806508
You can use the AfterUpdate Event of your Status control on the form to run SQL that will append the 3 fields of data to your table.

Let me know if you need details.

ET
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 41806549
Here is a sample ...

DoCmd.RunSQL "INSERT INTO  tbl_StatusUpdates ( STATUS_NAME, DATE_UPDATED, USER_NAME ) " & _
    "Values ('" & Forms!Form1!TxtStatus_Name & "', #" & DATE() &"#, '" & Environ('User') &"');"

ET
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question