Solved

Writing a record to a table.

Posted on 2016-09-20
2
50 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

696 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