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

Expanding a Series

aW
I have an interesting dilemma.

I have a table with the following records:

================================================== =
Box | Series Start | Series End
========+=======================+================= =
1 | 0001 | 0025
---------------------------------------------------
2 | 0026 | 0050
---------------------------------------------------
3 | 0051 | 0075
---------------------------------------------------
4 | 0076 | 0100
---------------------------------------------------

Now, I need to create a new table that will expand each of the series in
the above table:

==========================
Box | Serial No.
========+=================
1 | 0001
--------------------------
1 | 0002
--------------------------
1 | 0003

... ... ...

--------------------------
1 | 0025
--------------------------

What comes to mind right now is creating a form with a 'while' loop. But I
would have to load the form and then press a button to run it. It would be
nice to somehow create a make table query that will do the trick.

Any ideas will be greatly appreciated!

aW.
--
Thanks a million!
Nov 13 '05 #1
4 1765
Just a stab....
but how about a cartesean result instead of a new table.

You would have a table with all the values as individual records (1....100)
Then make a query with this table and the table (or query ) with the series
data.
Don't make any join betwen them......
You will then get a record for each possibility.
Limit this for each Box....by using Between [Series Start] and [Series End]

?????
Mal.

"aW" <a@no.spam.net> wrote in message news:40********@127.0.0.1...
I have an interesting dilemma.

I have a table with the following records:

================================================== =
Box | Series Start | Series End
========+=======================+================= =
1 | 0001 | 0025
---------------------------------------------------
2 | 0026 | 0050
---------------------------------------------------
3 | 0051 | 0075
---------------------------------------------------
4 | 0076 | 0100
---------------------------------------------------

Now, I need to create a new table that will expand each of the series in
the above table:

==========================
Box | Serial No.
========+=================
1 | 0001
--------------------------
1 | 0002
--------------------------
1 | 0003

... ... ...

--------------------------
1 | 0025
--------------------------

What comes to mind right now is creating a form with a 'while' loop. But I
would have to load the form and then press a button to run it. It would be
nice to somehow create a make table query that will do the trick.

Any ideas will be greatly appreciated!

aW.
--
Thanks a million!

Nov 13 '05 #2
aW
Mal Reeve wrote:
Just a stab....
but how about a cartesean result instead of a new table.

You would have a table with all the values as individual records
(1....100) Then make a query with this table and the table (or query )
with the series data.
Don't make any join betwen them......
You will then get a record for each possibility.
Limit this for each Box....by using Between [Series Start] and [Series
End]

?????
Mal.

"aW" <a@no.spam.net> wrote in message news:40********@127.0.0.1...
I have an interesting dilemma.


Thank you for your response, I'll play with this for a while.

--
Thanks a million!
Nov 13 '05 #3
aW <a@no.spam.net> wrote in message news:<40********@127.0.0.1>...
I have an interesting dilemma.

I have a table with the following records:

================================================== =
Box | Series Start | Series End
========+=======================+================= =
1 | 0001 | 0025
---------------------------------------------------
2 | 0026 | 0050
---------------------------------------------------
3 | 0051 | 0075
---------------------------------------------------
4 | 0076 | 0100
---------------------------------------------------

Now, I need to create a new table that will expand each of the series in
the above table:

==========================
Box | Serial No.
========+=================
1 | 0001
--------------------------
1 | 0002
--------------------------
1 | 0003

... ... ...

--------------------------
1 | 0025
--------------------------

What comes to mind right now is creating a form with a 'while' loop. But I
would have to load the form and then press a button to run it. It would be
nice to somehow create a make table query that will do the trick.

Any ideas will be greatly appreciated!

aW.


Something like this maybe... note, this uses DAO, so if you're using a
version after 97, you'll have to make sure the DAO 3.6 library is
checked in your references...

Option Compare Database
Option Explicit

Sub CreateBoxSeries()
Dim db As DAO.Database
Dim rsSrc As DAO.Recordset '-read series from this table
Dim rsDest As DAO.Recordset '--write created records to this
table
Dim intCounter As Integer

Set db = CurrentDb
Set rsSrc = db.OpenRecordset("tblCreateRecords",
dbOpenForwardOnly)
Set rsDest = db.OpenRecordset("tblBoxSerials", dbOpenTable,
dbAppendOnly)

Do Until rsSrc.EOF
'--insert a record in to rsDest for each number between the
ranges
For intCounter = rsSrc.Fields("SeriesStart") To
rsSrc.Fields("SeriesEnd")
With rsDest
.AddNew '--add a new record to the table
.Fields("BoxNo") = rsSrc.Fields("BoxNo")
.Fields("SerialNo") = Format(intCounter, "0000")
'--save it formatted as 0075 etc
.Update '--save the record
End With
Next intCounter
rsSrc.MoveNext '--go to the next series to create
Loop

'--Clean up
Set rsSrc = Nothing
Set rsDest = Nothing
Set db = Nothing

End Sub
Nov 13 '05 #4
aW
Pieter Linden wrote:
<sniped>

End Sub


Thank you, I'll see what happens.

--
Thanks a million!
Nov 13 '05 #5

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

Similar topics

1
by: Sriram Krishnan [at] gmx [dot] net | last post by:
Given an arbitrary number series, how do I identify the series and find the Nth number... for e.g 1,3,5,7 is an AP and the next number will be 9 1,8,27,64 is the series of cubes and the next will...
1
by: Bhiksha Raj | last post by:
Hi, I created an expanding menu on one of the frames in my webpage using code I got from http://www.dynamicdrive.com/dynamicindex1/navigate1.htm I have embedded the code (with minor...
1
by: Sriram Krishnan [at] gmx [dot] net | last post by:
Given an arbitrary number series, how do I identify the series and find the Nth number... for e.g 1,3,5,7 is an AP and the next number will be 9 1,8,27,64 is the series of cubes and the next will...
6
by: Jack | last post by:
Hello, I would like some advice on how to disable the behavior of treeviews to expand and collapse when double clicked upon, but still allow the user to use the plus and minus on each node. ...
4
by: geoffp | last post by:
I need to generate reproducible random number series. I've done the obvious - use mt_srand with the same seed. This supposedly will create the same series every time. Is this true? Its not...
13
Chrisjc
by: Chrisjc | last post by:
I am in need of an expanding and collapsing code… The goal is To be able to click a PICTURE IMAGE and expand to show information Reason for this is I have 3 TABLES of information of about ...
4
by: keirnus | last post by:
Hello, I've been coding in Access VBA to create an Excel Graph and it was good. Until I got this error: Please check the code below: Private Sub TestGraph3()
1
by: Scholar | last post by:
Hi,i am working on a c++ project which will find the nth term of a given series.The series would be given in the form of first 4 or 5 terms.I have the basic alogorithm which can find the nth term of...
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
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,...
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,...

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.