Solved

Writing a record to a table.

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now