473,473 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

adding strings to a table based on their entry into another table

I have a table called tblParttest. It has fields PartNo, PartNo2, PartNo3, ..
.., PartNo25 and Quantity, Quantity2, Quantity3, ...Quantity25.

If I enter "1234" into the PartNo field and "4" into the Quantity field, I
would like "1234" to be put into another table 4 times. The table would be
called tblClaimedParts, and after this first entry would look something like
this:

Claimed Parts
1234
1234
1234
1234

If I were to enter "5432" into the PartNo2 field (still of record 1) and "7"
into the Quantity2 field, tblClaimed parts would then look like this:

ClaimedParts
1234
1234
1234
1234
5432
5432
5432
5432
5432
5432
5432

If there is a way to just get it to look like this then I would very much
like to know. An even better scenerio would appear as follows:

ClaimedParts Quantity
1234 4
5432 7

I would appreciate any help I can get.

Thanks in advance.
--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
3 1463
Having seen your proposed design from a previous post, may I ask why
you want to do this? It is certainly possible, but my guess is that
this may make things better in the short term (the data will be
entered) but worse in the long term (because the data will be
denormalized and hard to summarize).

I would choose option 2.
create a table consisting of PartID and Quantity. Then use a totals
query to get the sum of Quantity.

Nov 13 '05 #2
I have to have several fields for the part numbers and quantities because
this is for warranty claims and I must allow several parts to be entered in
one record.

pi********@hotmail.com wrote:
Having seen your proposed design from a previous post, may I ask why
you want to do this? It is certainly possible, but my guess is that
this may make things better in the short term (the data will be
entered) but worse in the long term (because the data will be
denormalized and hard to summarize).

I would choose option 2.
create a table consisting of PartID and Quantity. Then use a totals
query to get the sum of Quantity.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #3
You'll probably have to adjust the fieldnames and table names to suit
your needs.

Private Sub Command0_Click()
Dim rsSrc As DAO.Recordset 'refers to table
containing how many of each record to create
Dim rsDest As DAO.Recordset 'table to write data to.
Dim intCounter As Integer

Set rsSrc = DBEngine(0)(0).OpenRecordset("tblCreateRecords",
dbOpenForwardOnly)
Set rsDest = DBEngine(0)(0).OpenRecordset("tblClaimedParts",
dbOpenTable)

Do Until rsSrc.EOF
For intCounter = 1 To rsSrc.Fields("Qty")
With rsDest
.AddNew
.Fields("ClaimedPartID") = rsSrc.Fields("ClaimedParts")
.Update
End With
Next intCounter
rsSrc.MoveNext
Loop

rsSrc.Close
Set rsSrc = Nothing
rsDest.Close
Set rsDest = Nothing
End Sub

Nov 13 '05 #4

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

Similar topics

47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
6
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...
13
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...
7
by: Roman Mashak | last post by:
Hello, All! I wonder is it possible to define an array containing strings, not single characters? What I want is array 'table' that will have N elements, and every element is a strings tailoring...
7
by: Mike | last post by:
List, I call this a "Parsing Problem", but it could be called formatting or regular expressions as well. I have a set of data that was formerly processed on an OS390 (hence a lot of...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
0
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,...
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...
1
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
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.