473,698 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update records in child table based on value in parent table

Tom
hello
i have 2 tables linked by a common id. The first table has records
with a specific field with numeric values. eg 3 or 6 or 10 etc. What i
want to happen is when i create a data entry form, i can scroll thru
each record and when a value such as 6 comes along, the second/child
table allows for 6 records to be created based on the same unique id
using a data entry form
eg
table 1
id 6
value 6

table 2
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"

How can i do this
thanks
tom
Nov 13 '05 #1
1 3192
Perhaps you could use the recordset object, and iteration, for/next to add
the six new records to table.
You will probably need a trigger (button) to call the routine after you have
stopped at the record on the parent table/form.
This will then run you code to populate the foreign key (id) of the second
table.

code might look something like....

sub MyButton_click( )

dim rs as recordset
dim db as database

set db=currentDb
set rs=db.openrecor dset("Table2",d bopendynaset)

with rs
for i= 1 to 6
!id=IdTextBoxOn Form
end with

end sub

"Tom" <ge*****@yahoo. com> wrote in message
news:bf******** *************** ***@posting.goo gle.com...
hello
i have 2 tables linked by a common id. The first table has records
with a specific field with numeric values. eg 3 or 6 or 10 etc. What i
want to happen is when i create a data entry form, i can scroll thru
each record and when a value such as 6 comes along, the second/child
table allows for 6 records to be created based on the same unique id
using a data entry form
eg
table 1
id 6
value 6

table 2
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"
id 6 "data entry"

How can i do this
thanks
tom

Nov 13 '05 #2

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

Similar topics

3
9756
by: Justin | last post by:
I have created a dataset with two tables and an insert command, I need to be able to retreive the Key Identity after inserting into table "A" for use in table "B". Should I use ExecuteScalar() or is there a better solution? Thanks, Justin.
8
5351
by: Greg Peck | last post by:
Hi I need to update a field (fldX) in one DataTable (dt1) where there is a match on fldA in another DataTable (dt2). Is the only way to do this by itterating through the DataRows of dt1, serching dt2 for a matching fldA and if found do the update and then move on to the next row? Thanks Greg
3
2408
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
5
3537
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I do the update the changed parentid in the child table fails to change. No error is given its just that the change is not written to the Database. When I step through the records for the child table the one I would expect to be changed has a row...
4
1859
by: TGEAR | last post by:
Itemlookup table Field names : index_id (primary key), itemno, description. It has a child table, which is ItemPriceHistory table The relationship to the child table is one (parent table)-to-many (child table). - It is possible to have no child record for some rows in the parent table. ItemPriceHistory table Field names: index_id (primary key), itemlookupID (foreign key of the Itemlookup table), date begin, price
1
2624
by: James Hallam | last post by:
I have a parent record with a child record. The parent record contains structures and the child records contains visits to those structures. Each table has a field named "Complete", what I want is the structure 'complete' to be changed to true when ANY of the visits have been completed. I have tried to implement SQL to do this, but it gives me the error
1
2772
by: Hexman | last post by:
Hello All, What I'm trying to do is update a child record using a parent-child relation. I want to find out if it is faster than than doing multiple selects. Anyways, I've created a dataset (ds), have 2 datatables (dtRC and dtST). Created the parent-child relationship with multiple columns and added the relation to the dataset. Now what I want is to move through each of the dtRC (parent) records, get all related dtST (child) records...
2
3329
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a certain number of them. Firstly I identify all the parent records that have the requird number of child records and insert them into the result table.
0
3236
by: Access Programming only with macros, no code | last post by:
ERROR MESSAGE: Could not update; currently locked by another session on this machine. BACKGROUND I have the following objects: Table1 - HO (which has about 51,000+ records) Table2 - Contact (which has 68,000+ records)
0
8680
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
8609
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
9169
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
9030
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...
0
8871
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
5861
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();...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.