473,385 Members | 1,282 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,385 software developers and data experts.

how to add a set of records to a table

Hi,

I have a table tblYears with fields - TrnYear, Balance
And also a table called tblMonths with fields - TrnYear, TrnMonth, MthValue, DateEnd.

There is a one to many relationship between the two.

I would like from a form that when I type a Year number and click on the command button that a new record should be added with the entered value to tblYears, but also then add 1,2, through to 12 to the TrnMonth field in tblMonths. All in one click if possible.

So in short. A new should be added to tblYears, and 12 new records (1 2 3 4 5 6 7 8 9 10 11 12) to tblMonths for the same year.

Could anybody help?
Feb 25 '12 #1
1 1143
Between the begin transaction and end transaction you should be insert records in both tables.

first you should be insert YEAR FIELD VALUE in tblyear table and after that just declare a variable integer type and increase variable value by 1 with in for loop and also write the insert statement of the 2nd Table TBLMONTH with in for loop with same year which you insert in first table.

i think as like u can add.
asnd if any error is generated no any record will be added in both table bacause end transaction is not executed. and after end transaction records will be saved successfully in both tables.
Feb 26 '12 #2

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

Similar topics

1
by: Eranut | last post by:
Hi, I am trying to understand if there is a way to send a table of records (table of structs) from pro C to Oracle pl/sql stored procedure. Since Oracle is demanding definition of the *sent*...
9
by: paul | last post by:
Hiya everyone, I have two tables in SQL 2000. I would like to append the contents of TableA to TableB. Table A has around 1.1 Million Records. Table B has around 1 Million Reocords. ...
5
by: Alex | last post by:
Hi, I have two tables , A and B where table B has a foreign key constraint to table A. I want to delete all records in table A that are older than a certain date that are not referenced by...
2
by: Jason | last post by:
I have a table of 650,000 records associated to contracts. Some of the contracts have multiple records but each contract only has one Active Record (there might be several inactive records). ...
6
by: John | last post by:
I've got a single table I need to query to return records that have no "related records." Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology The...
9
by: Dennis Gearon | last post by:
I am designing something that may be the size of yahoo, google, ebay, etc. Just ONE many to many table could possibly have the following characteristics: 3,600,000,000 records each record is...
18
by: shinyo21 | last post by:
Anyone know how to create a SQL or way in Access for deleting few tables' record. I means is delete all the records in specify few tables. I tried to use query to delete the records' table but...
1
by: apprenticewizard | last post by:
Please help....been at this for several days and just can't seem to find a solution. I've got two tables, Emp Info and Labor Records. The form to populate the Labor Records table contains a combo box...
10
by: jambonjamasb | last post by:
Hi all, I am new to this and am looking for some direction I have the ideas, but am having trouble putting it into practice. Any help would be greatly appreciated. I have set up three tables. ...
2
by: Paula Fox | last post by:
Recently, my access database main records table was "cloned" and is now being hosted on a SQL server as a linked table to my existing Access database. Now, the Record search box (in the form) does...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.