Incrementing value in label in report after each print (1 Viewer)

baduba

New member
Local time
Today, 07:23
Joined
Aug 24, 2017
Messages
3
Hello all,
I am looking to generate a report from a user populated form which will work as a pallet load flag. I already have a form that acquires values from user such as jobNumber, cartonWeight, etc. Where I am having an issue is numbering the load flags. I have a field on the form where a user can enter the number of load flags they would like to pring, and, I have succeeded at implementing that as the number of flags to print, however, I have not been successful at generating code that will increment what would be the loadNumber by one after each print - thus, basically serializing each load flag printed. Ideal end result would be that the user will get the number of load flags they entered in the form and the load flags would be sequentially numbered starting with load number 1. Any help would be greatly appreciated!

So far this is the code I have used to print the necessary amount of load flags. I used a loop with a print command. In my mind, I would like to find a way to update a label on the report within this loop, however, I have not been successful in doing that.

LoadNumber equals the number of load flags entered in the form by the user.

Code:
Do While intIndex <= LoadNumber

    strIndex = intIndex

    DoCmd.SelectObject acReport, "LoadFlagReprt", True
    DoCmd.OpenReport "LoadFlagReprt", acViewPreview, , , acWindowNormal, strIndex
        DoCmd.PrintOut , , , , 1
    intIndex = intIndex + 1
Loop
 

Minty

AWF VIP
Local time
Today, 12:23
Joined
Jul 26, 2013
Messages
10,354
If you passed the strIndex as OpenArgs to the report you could set the label to that value in the reports formatting code.
 

Users who are viewing this thread

Top Bottom