473,511 Members | 15,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA - duplicating record sets based off 1 field quantity and 1 field reference?

1 New Member
First off - I want to thank all who respond / try to help out and even those who took a moment to read over my question.

Please be patient as I am -very- new to VB in general and unfortunately I've only had the chance to pick up pieces here-and-there. So keep that in mind when reading my inquiry as I am liable to misuse terminology.

My question, although lengthy, is likely quite basic but I can't seem to find a solution and yes I have searched around.

I am required to print off a report, using Access 2000, when ever material is requested from our customer. The report itself is more so a label that we stick to each piece of material. (Prints out on single 4x1 label via Zebra Printers)

I have mutiple fields in the form for data entry but my main focus is the 'quantity' field.

The problem comes when the report pulls the information from the form. If 1 piece of material is requested that is fine but when several pieces of material is requested I run into a dilemma.

For example; If 1 piece of 'x' is requested I would place 1 in the quantity field then enter the remaining information and click print which would produce 1 label. If 10 pieces of part 'x' is requested then I place a 10 in the quantity field -not- enter the part 10 times into the form. Obviously I could just print 10 copies but unfortunately there will also be requests for parts 'y' and 'z' with different quantity variances.

I would like to add some code to the 'On Click' procedure so access will reference the quantity field (txtQuantity) and create that many labels per piece of material since 1 is required for each individual part. It would also likely require a reference to the Part number (txtPart) field to differentiate which record to duplicate/create another label for with quantities greater than 1, correct?

My only other piece of information I can provide that may change the suggested code is how the form works in itself. When you first enter the form from the main menu there is only 1 record set to enter information into. The moment you begin typing information into the fields another record set is created to enter the info for the next piece of material. When you click on print it's set to auto-save the records and I 'believe' it deletes any set with a null value. (so we don't generate blank labels)

This DB was created prior to my entering the position and as posted earlier I am very wet behind the ears with VBA (please keep that in mind when posting a response) and semi confident in access itself. I am starting a VB course next month but until then I am forced to 'wing it' and hope I can find answers on my own and hope others can give me a hand in the process. I am not looking for a pasted solution I would definitely like an explanation of the code as I am trying my best to learn in the process.

Thanks again to anyone who can help!
Apr 12 '07 #1
2 2603
Denburt
1,356 Recognized Expert Top Contributor
Lets start with the form you use to call the report, would you please show us the code for your 'On Click' procedure. I sounds like you simply need a loop statement to cycle through and print. I just recently created something very similar so lets see what your code looks like.
Apr 20 '07 #2
NeoPa
32,557 Recognized Expert Moderator MVP
In pseudo code :
  1. Have a table (We'll call it tblTemp) to store the data required to run the report.
    1. Clear the old data from [tblTemp].
    2. Run through the source table and process each record.
    3. For each record loop through [Copies] times and add a record into [tblTemp] in each iteration of the loop
  2. Run your report which is driven from [tblTemp].
Apr 23 '07 #3

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

Similar topics

6
2496
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...
15
4643
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
6
3053
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
3
6364
by: Chuck | last post by:
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...
19
3442
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
1
5869
by: Catriona | last post by:
I am developing an Access application where users insert bill records for an electricity account by clicking on a new button. The required workflow is 1) New button clicked 2) New record appears...
10
1980
by: necapa82 | last post by:
I have an Access 2000 database in which I need to update both records in a pairing, based on the difference in the value of a quantity field. This is an example of the pertinent data in the table....
3
6064
by: kevinj | last post by:
Greetings, I am creating a "stoplight" type report that is based on the number of days between dates, the field will be highlighted in red, yellow, or green. I am able to change the background...
1
4010
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
0
7367
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
7430
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
7089
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
7517
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
5673
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,...
1
5072
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...
0
4743
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
3230
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
1581
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.