473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Data entry to multiple tables

I need to enter data into multiple tables from the same field in one
form. Is this possible? If so, how do I accomplish it.
Example: I need to enter changes to a customer master table (name,
address, city, state, etc) but I need to have a historical table that
keeps track of the past history of the account. So when I edit and
update the customer master information, from a form, I want that
record to be entered into the historical table, as well, as a new
record, without having to retype the same information into different
fields.

Thanks for the help.
Nov 12 '05 #1
1 3784
TC
You could use an INSERT INTO sql statement to copy the current (unchanged)
record from the form's base table, into the history table:

(untested)

dim db as database, sql as string
sql = "INSERT INTO tblHistory (CustID, CustName, CustDOB)" & _
" SELECT CustId, CustName, CustDOB" & _
" FROM tblFormsBaseTable" & _
" WHERE CustId = """ & me![CustId] & """"
set db = currentdb()
db.execute sql, dbfailonerror
set db=nothing

The problem is, where to put that code?

Form_BeforeUpdate is too early, because the update might be rejected with a
missing required value, or whatever. Form_AfterUpdate is too late, because
by then, the changes have been copied into the form's base table - Catch 22!

I would be inclined to put it in BeforeUpdate, but include a "pending" flag
in the history record. Then you could erase that flag from AfterUpdate. This
isn't bulletproof - it does open you to the small risk of the system failing
before you erase the pending flag - but it does have the virtue of
simplicity.

HTH,
TC
"Mike" <mi********@dey.com> wrote in message
news:3e**************************@posting.google.c om...
I need to enter data into multiple tables from the same field in one
form. Is this possible? If so, how do I accomplish it.
Example: I need to enter changes to a customer master table (name,
address, city, state, etc) but I need to have a historical table that
keeps track of the past history of the account. So when I edit and
update the customer master information, from a form, I want that
record to be entered into the historical table, as well, as a new
record, without having to retype the same information into different
fields.

Thanks for the help.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
2
by: IanCraft | last post by:
I am new to Access 2002 and have a questions regarding using a form for data entry. I have 15 items I need to keep track of that are listed individually on a form as follows: Item#1Name ...
1
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The...
8
by: Wingot | last post by:
Hey, I have a program I am trying to write using Visual C#, SQL Server 2005/2008, and Visual Studio 2008, and one part of it includes a Schema called Client. Inside this schema, three tables...
2
kcdoell
by: kcdoell | last post by:
Hello: I have four tables: tblDivision tblWorking_Region tblCredit_Region tblForecast (This is the main data entry table for all forecasting records) tblDivision has the following fields:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.