473,756 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding records to a separate table based on inputs to a form

60 New Member
Hi All,

I am using Access 2003 and have a continuous form based on a table (table1) as a subform on another form. I simply want to be able to take any records that get added to table1 through the subform and populate a 2nd table (table2) with these added records from the subform the instant they are added. The two tables both contain a common ID field. Also if any values in existing records on the subform change I would like to update a calculated field in table2 using these new values. How can I do this using VBA? I'm stumped.

Any help would be appreciated. Thanks
Oct 20 '08 #1
3 1608
missinglinq
3,532 Recognized Expert Specialist
The big question here is WHY? Storing most data in more than one place is in direct violation of all the principals of relational database design; storing entire records certainly is. You probably need to take a look at Database Normalization and Table Structure.

Welcome to Bytes!

Linq ;0>
Oct 20 '08 #2
ramprat
60 New Member
Thanks Linq. My first table stores certain parameters about a road. The second stores calculated values that are calculated from the parameters in table 1. This makes the fields in table 2 dependent on fields in Table 1 as thus should be stored separately (I believe). As I add new roads to my first table through my continous form I need to add a record to the second table which will have the common road_id value that links the two tables together. I was hoping to be able to have this work automatically every time a new road is added to the first table through the form.

I hope this makes it clearer. Thanks
Oct 20 '08 #3
nico5038
3,080 Recognized Expert Specialist
As stated, storing redundant data is against normalization rules. Storing calculated values isn't "normalized ", but sometimes, when the calculation done is lengthy, necessary.
As you found out, changing values cause trouble :-)

The solution is however "simple", just create a query with the calculations to get a proper endresult. When this query is too lengthy to use for "direct reference" just change it into an INSERT INTO query and fill a table (e.g. overnight) and use that.
When the original data changes, just rerun the query to build a new table.

Nic;o)
Oct 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
39781
by: Michelle | last post by:
I have a div that is initially empty. Clicking on a button will add some text boxes and other controls so the user can add additional records. In IE all works fine but in Netscape 7.0 when I add another "record" the values for all previous controls within the div are wiped out. In the javascript function where I add on to the html in the div if I capture all the data in the previous "records" then after adding the new record I can...
5
3748
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for Office 2000. I am creating a database to track student athletes. I have created the following tables. The table title is to the far left, with fields under each. The common field will be the StudentID field, which is their student number assigned...
6
2506
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
13
2698
by: Shannan Casteel via AccessMonster.com | last post by:
I set up two tables (one with the regular claim info and another with ClaimNumber, PartNumber, and QuantityReplaced). The ClaimNumber is an autonumber and the primary key in both tables. I made a one to one relationship between the two tables. I have a form for the parts. It includes 25 text boxes for both the part numbers and the quantities, so 50 total. I set the control sources for each of the part number text boxes to PartNumber...
3
4884
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
6
4430
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire row doesn't get filled. I have a connection and all that stuff. Private Sub btnPlaceBet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaceBet.Click ' Dim Myds As Footbet.DStable '...
2
3672
by: Kosmos | last post by:
Alright so I've got this Outlook code written in VBA in Access. The first part, which works, records information about appointment times based on the required days before notification of certain contracts and then it adds them to the outlook calendar of the current user. This code works and is nested within a bunch of if statements because it only needs to trap certain appointments. The table I create with this code is later used to attempt to...
5
2517
by: jrodcody | last post by:
Hello: I am trying to create multiple records in a table named tblTravel based on the input of a date range in two form controls. The inputs for the form are LastName, TravelDate, EndDate, Event, LocationCity, and LocationState. Everything works perfectly, except for the fact that the dates do not correctly enter into the table. For example, if I enter a date range of March 3, 2008 - March 5, 2008 and click OK, 3 records are generated. ...
4
4846
by: zoeb | last post by:
Hi. I have a form which the user enters 2 years worth of data into (one record per year). The aim, is to populate the table this form is based on with 3 more years worth of data (i.e. creating 3 new records), based on a percentage increase on the previous year. This form is based directly on a table called tblBudgetShareProj. So far I have the following code but I am COMPLETELY new to VB and I'm very aware of how incomplete it is. I have a...
0
9462
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
9287
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
10046
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...
0
9886
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
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
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
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
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.