473,809 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3804
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 tblFormsBaseTab le" & _
" WHERE CustId = """ & me![CustId] & """"
set db = currentdb()
db.execute sql, dbfailonerror
set db=nothing

The problem is, where to put that code?

Form_BeforeUpda te is too early, because the update might be rejected with a
missing required value, or whatever. Form_AfterUpdat e 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.goo gle.com...
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
19819
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 file icon on a computer desktop, it will open up a data entry form (that was created in Access). That way, the people who enter the data won't have direct access to the database at any point. I've seen that this can be done, but I don't know...
2
6616
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 AmountOut AmountIn Item#2Name AmountOut AmountIn etc. Each day, the user opens this form and records the amount they have taken or put in for each of the 15 items. This form, when submitted,
1
4788
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 item is a panel, with a specific texture. There are standard panels that are then produced in a limited number of specific textures. The number of panels/project varies, so I keep track of the actual number of panels per project with the count:...
8
2935
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 exist named Country, MedicalCondition, and Customer.
2
2097
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
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10378
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.