473,406 Members | 2,769 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,406 software developers and data experts.

Looping thru multiple records

Reading through multiple records, with Loop capability
--------------------------------------------------------------------------------

Hi,

I have three tables as below:

Table: Demand
ITEM_ID, QUANTITY
Item A, 10

Table: Route
ITEM_ID, OPERATION_NO, RESOURCE, TIME
Item A, 10, RES1, 60
Item A, 20, RES2, 120
Item A, 30, RES3, 60

Table: Load

RESOURCE, LOAD
RES1, 600
RES2, 1200
RES3 , 600

The values in LOAD field of the LOAD table are calculated values.

What I want to achieve?
I want to calculate the LOAD field in the LOAD table

Steps:
1) Select the records for every ITEM_ID (e.g. Item A ) in the Route table.
2) Start with the lowest number of Operation_No (e.g. Operation_No 10), check the following:
a. Value in the RESOURCE field (e.g. Res1) and value in the TIME field (e.g. 60).
3) Multiply the value in the ROUTE.TIME field with the corresponding value in DEMAND.QUANTITY. (ROUTE.ITEM_ID = DEMAND.ITEM_ID)
4) Update the Table Load with the following values:
a. RES1 in field RESOURCE
b. The multiplied product we got in Step 3 above in the LOAD.LOAD field.
5) Go back to Step 2 above and select the next lowest record for Item A ( Operation_No = 20 in this case) and perform the following steps:
a. Step 2.a
b. Step 3
c. Step 4
6) Go back to Step 2. Continue this iteration (loop) until we complete all the records for this item. (In this case, there are three records for Item A: Operation_No: 10, 20 & 30).
7) Once all the records for Item A are processed and the LOAD table is updated, then go back to Step 1 and select the next item.
Feb 12 '07 #1
3 2136
maxamis4
295 Expert 100+
My First question is how well do you know VB?

To do this you will have to do it programmatically. So in order to proceed you will have to know visual basic to start of with.

You will need to understand ADO in order to create record sets to compare too.

I will help you step by step if needed but it will be a long task if you do not understand VB.
Feb 12 '07 #2
HI Maxamis,

Thanks for your quick reply.

I am sorry, but, I have no knowledge of VB. I hope you can help.

Thanks,

Ravi
Feb 12 '07 #3
NeoPa
32,556 Expert Mod 16PB
Before you continue with this you may want to read (Normalisation and Table structures) and reconsider your whole approach. It is not recommended (for very good reasons) to maintain calculated fields in your tables.
You may also want to consider asking questions of less scope. We try to discourage anyone from asking for their whole project (including design by the looks of it) to be done by our experts.
We're happy for you to come here and ask questions to help you progress and learn, but this is not a programming resource.
Think of it more as a crutch than a motor-vehicle, but a crutch that helps you to learn to walk.
Perhaps you should read the link then reconsider how your database should work. We can help you with that and future questions (of more limited scope) on how to implement various features of it.
Feb 12 '07 #4

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

Similar topics

0
by: Comcast News | last post by:
Hi , We are facing a java issue. We are looping thru a resultset which has about 40 K records. The process terminates abnormally after about 20-25K records. The Query fetches has 400 columns. We...
0
by: M P | last post by:
I need a code that will update multiple records on a list thru checkbox. If the record is selected, the details that was updated on the selected record will copy the same value as what is...
8
by: RC | last post by:
I have a table that lists many box numbers. Each box number has a Pallet Number (indicating which pallet the box is in). When the Pallets are loaded into a shipping Container I need to update the...
1
by: David | last post by:
Hi, I have a continuous form based on a query. Lets say the form displays 6 records. I also have a button against each record which sets a field to Y or N for each record. I am trying to...
1
by: u473 | last post by:
I am still a beginner with VBA and I need the VBA Code for the following problem. I have a list of activities with their Scheduled Start date, Duration, and Working hours in Table1. I need to...
6
by: doncee | last post by:
Using a multi select list box to open several records in a pre - defined form. Most of the code that follows is taken from a posting by Alan Browne on his web site. The click routine is supposed...
1
by: pds79 | last post by:
Hi everyone, I'm a newbie to the forum. I have an issue and was hoping to get some assistance/ideas: Im trying to read a XML file into two record sets. I can acheive looping through the...
6
by: mahowe | last post by:
Hi, I have had this problem for a while and have not been able solve it. What im looking at doing is looping thru my patient table and trying to organise the patients in to there admission...
0
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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:
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...
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
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...
0
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,...
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.