I have a perfectly working form and report, so I don't have a problem (for a change). I desire to take something slick and make it slicker, but I don't know how.
I have a form set up which you enter a CUST_NUM (or multiple CUST_NUMs separated by commas) and the form passes those customer numbers to a report which is setup for labels to print shipping labels. The report is designed to allow the user to skip labels (that were used off the sheet previously, so you can start the printing down the sheet a ways) and also print however many copies of the label the user wants. I'm not brilliant, I got the idea and code from this link:
http://support.microsoft.com/kb/299024 I did EXACTLY what it says in this link with no changes. It works perfectly. I will post my code just in case you don't want to look at the link:
What I desire to do is where I'm stuck. Each customer needs a different number of labels printed. The number needed is stored in tblCUSTOMERS, field [NUMBER OF BOXES]. I want to take that number stored, multiply it by 2, and have the report print the appropriate number of labels for each customer requested.
For example:
Customer 100 needs 3 boxes. The "3" is stored in the table. Print 6 labels.
Customer 101 needs 5 boxes, "5" is stored in the table, print 10 labels.
On the form that passes the CUST_NUM to the report, I want to enter "100, 101". The report will open and ask me to "Enter Number of blank labels to skip" but NOT ask user to "Enter Number of Copies to Print", and of course, print the right number of labels for every customer I put on the form.
This is way over my head. Can someone help?
THANKS THANKS THANKS!!!!!
I have a form set up which you enter a CUST_NUM (or multiple CUST_NUMs separated by commas) and the form passes those customer numbers to a report which is setup for labels to print shipping labels. The report is designed to allow the user to skip labels (that were used off the sheet previously, so you can start the printing down the sheet a ways) and also print however many copies of the label the user wants. I'm not brilliant, I got the idea and code from this link:
http://support.microsoft.com/kb/299024 I did EXACTLY what it says in this link with no changes. It works perfectly. I will post my code just in case you don't want to look at the link:
Code:
'********************************************************* 'Declarations section of the module. '********************************************************** Option Compare Database Option Explicit Dim LabelBlanks& Dim LabelCopies& Dim BlankCount& Dim CopyCount& '========================================================== ' The following function will cause an input box to ' display when the report is run that prompts the user ' for the number of used labels to skip and how many ' copies of each label should be printed. '=========================================================== Function LabelSetup() LabelBlanks& = Val(InputBox$("Enter Number of blank labels to skip")) LabelCopies& = Val(InputBox$("Enter Number of Copies to Print")) If LabelBlanks& < 0 Then LabelBlanks& = 0 If LabelCopies& < 1 Then LabelCopies& = 1 End Function '=========================================================== ' The following function sets the variables to a zero '=========================================================== Function LabelInitialize() BlankCount& = 0 CopyCount& = 0 End Function '=========================================================== ' The following function is the main part of this code ' that allows the labels to print as the user desires. '=========================================================== Function LabelLayout(R As Report) If BlankCount& < LabelBlanks& Then R.NextRecord = False R.PrintSection = False BlankCount& = BlankCount& + 1 Else If CopyCount& < (LabelCopies& - 1) Then R.NextRecord = False CopyCount& = CopyCount& + 1 Else CopyCount& = 0 End If End If End Function Private Sub Report_Load() DoCmd.ShowToolbar "Ribbon", acToolbarYes End Sub Private Sub Report_Close() DoCmd.ShowToolbar "Ribbon", acToolbarNo End Sub
For example:
Customer 100 needs 3 boxes. The "3" is stored in the table. Print 6 labels.
Customer 101 needs 5 boxes, "5" is stored in the table, print 10 labels.
On the form that passes the CUST_NUM to the report, I want to enter "100, 101". The report will open and ask me to "Enter Number of blank labels to skip" but NOT ask user to "Enter Number of Copies to Print", and of course, print the right number of labels for every customer I put on the form.
This is way over my head. Can someone help?
THANKS THANKS THANKS!!!!!
Comment