Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Writing a record to a table.

Posted on 2016-09-20
2
Medium Priority
?
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
Eric Sherman earned 2000 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 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