473,549 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

repeating a record x times in a query

Hi, I have a somewhat unique problem (at least unique to me, and I've
been doing this for longer than I care to admit). I have a client that
needs to print cards onto perforated card stock (so multiple records
per page), and they need to print out x copies of the same information
onto the cards. So for instance I have a record that has a name,
address, id number and then a number for the number of copies of that
record that needs to be printed out.

I know I can do this programmaticall y with the report to print out x
number of copies per record, but this would waste several hundred pages
of card stock by printing out blank cards. It also just doesn't seem
like the cleanest most elegant way of accomplishing this.

Has anyone ever accomplished this? Transforming a query of
"Name", "Address", 3
"Name2", "Address2", 2

to:

"Name", "Address"
"Name", "Address"
"Name", "Address"
"Name2", "Address2"
"Name2", "Address2"

Anyone have any ideas?
Any and all help would be appreciated.

-Charles

Nov 13 '05 #1
3 6369
Okay, in (partial) answer to my own, I can create a new table with the
desires results with the following function:

Function make_rst()

Dim db As Database
Dim rst, rst_new As Recordset
Dim i As Integer
Set db = CurrentDb
Set rst = db.OpenRecordse t("SELECT * FROM copy_test")
Set rst_new = db.OpenRecordse t("destination" )
While Not rst.EOF
For i = 0 To rst.copies
rst_new.AddNew
rst_new!Address = rst!Address
rst_new.Update
Next
rst.MoveNext
Wend

End Function

which sort of solves the problem, except that I really dislike "temp"
tables, and moving data around like this. Is there another solution
I'm overlooking?

Nov 13 '05 #2
"Chuck" <us****@popquiz hotshot.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi, I have a somewhat unique problem (at least unique to me, and I've
been doing this for longer than I care to admit). I have a client that
needs to print cards onto perforated card stock (so multiple records
per page), and they need to print out x copies of the same information
onto the cards. So for instance I have a record that has a name,
address, id number and then a number for the number of copies of that
record that needs to be printed out.

I know I can do this programmaticall y with the report to print out x
number of copies per record, but this would waste several hundred pages
of card stock by printing out blank cards. It also just doesn't seem
like the cleanest most elegant way of accomplishing this.

Has anyone ever accomplished this? Transforming a query of
"Name", "Address", 3
"Name2", "Address2", 2

to:

"Name", "Address"
"Name", "Address"
"Name", "Address"
"Name2", "Address2"
"Name2", "Address2"

Anyone have any ideas?
Any and all help would be appreciated.

-Charles

If the number of duplicates which are needed are not too large (and can be
guaranteed to be within a certain range) then you could achieve this using
no code at all with the help of another table:
tblCopy
Qty F1
1 1
2 1
2 2
3 1
3 2
3 3
4 1
4 2
4 3
4 4
etc

Then your query joins tblAddress.Qty to tblCopy.Qty so you get the correct
number of records.

Another way is to write some VBA within the report which forces the section
to be repeated until the correct number of copies is reached. This may be a
better solution, but the first has advantages too since you can use it for
the underlying query, whereas the second only works for reports.


Nov 13 '05 #3
From my files ----

Use the same methodology fir your cards!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

Print Multiple Labels Based Upon The Amount In A Column

Q I have a query that shows information about individual product items and
includes a column for quantity on hand for each item. Each item has a
different quantity on hand. for example:
ProductName QOH
item1 3
item2 2
item3 4
I would like to print labels, one for each of the items. In the above
scenario, I would need 9 labels and would like the labels for each item to
print consecutively. How do I design a query to read the "quantity on hand"
column and generate the appropriate number of records for each specific
item? For example, item1 has 3 in stock, the query would show:
item1
item1
item1
A Create a table (tblNums) with a single, numeric field (Num) and add
numbers(records ) from 1 to your maximum QOH. Add this table to the report's
record source query with no join between the tables. This is called a
cartesian query. Set the criteria under the Num field to:
<=[QOH]
You will get 3 records for Item1, 2 records for Item2 and 4 records for
Item3.

"Chuck" <us****@popquiz hotshot.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi, I have a somewhat unique problem (at least unique to me, and I've
been doing this for longer than I care to admit). I have a client that
needs to print cards onto perforated card stock (so multiple records
per page), and they need to print out x copies of the same information
onto the cards. So for instance I have a record that has a name,
address, id number and then a number for the number of copies of that
record that needs to be printed out.

I know I can do this programmaticall y with the report to print out x
number of copies per record, but this would waste several hundred pages
of card stock by printing out blank cards. It also just doesn't seem
like the cleanest most elegant way of accomplishing this.

Has anyone ever accomplished this? Transforming a query of
"Name", "Address", 3
"Name2", "Address2", 2

to:

"Name", "Address"
"Name", "Address"
"Name", "Address"
"Name2", "Address2"
"Name2", "Address2"

Anyone have any ideas?
Any and all help would be appreciated.

-Charles

Nov 13 '05 #4

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

Similar topics

4
4370
by: Dean | last post by:
I am a developer who works with MS SQL Server a lot, but I'm far from an expert. I am revamping an appointment scheduling system that allows for appointments to reoccur daily, weekly, monthly and yearly. Currently, I am saving the appointment date as the initial appointment date. Then when I want to check for appointments, my stored proc...
2
2474
by: tom | last post by:
Hi, I have built an Access DB for a child care business. Family table stores the Family info. Room the different room names, capacity etc. Price stores the various price codes and amounts. The Child table records the childs DOB, start date, end date etc. etc. and of course to which family he/she belongs, which room and which price category....
10
3044
by: Mark | last post by:
I have a table about people containing 25 fields. The table contains the usual fields - first, last, address, city, state and zip. There is no primary key. These fields all have data with the exception of a few records missing zip. A person may be in one to five records in the database. If a person is in multiple records, the other fields in...
2
3096
by: Alpha | last post by:
I have a C# program that user would select several search criteria and then outputs to the Crystal Report. A message is output to user if no matching record is found. In my code I also clear, removed and dispose of the table in the dataset that was used which should have nothing in it any way. I then clean up the search string that I built...
22
18776
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4. The system is client/server, multiusers based. The MDBs are using record locking. Here is part of the code: Dim wkSpace As Workspace, db As...
4
3505
by: Noah | last post by:
Hi, I bet the question below has been answered many times before, but I have not found an answer. If someone could point me to one that would be great! I have the following table: num run 1 1
0
9327
by: Killer42 | last post by:
This is a simple VB6 function to generate random numbers in the specified range, without repeating any numbers. New, and only briefly tested. Use at your own risk. :) Option Explicit Private UsedNumber As New Collection Private Const MaxAttempts As Long = 150 Private Const Zero As Long = 0 Private Const One As Long = 1
3
2158
by: dufnobles via AccessMonster.com | last post by:
I have created a query which returns a single record. I then display the four fields returned by the record on my form. I would like to display the same record three times with only the record number changing. Can this be done with Access 2000? I'm thinking that I would need some kind of VBA loop or something. I am open to any solution...
5
2323
by: squrel | last post by:
Hello everyone.. i have a small problem here... i have a combobox in my project call cmbresult which has been filled up in the properties by using list properties... i have 4 option there... whn i add a new record its fine and by clicking the drop down the 4 option is showing and i can select and add easily bt when i want to view any selected...
0
7521
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...
1
7473
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7810
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...
0
6044
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5369
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3501
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1944
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
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.