Print Button Question (1 Viewer)

Hydra427

Registered User.
Local time
Yesterday, 19:50
Joined
Mar 9, 2012
Messages
40
I have a text box "Label Printed" on a form for whether or not a label has been printed (yes/no, default is no). I also have a print button "Print Box Label" on that same form. I would like the text box to be updated to "Yes" when I use the print button. Is there some simple code for this action?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,474
How about?
Code:
Me.[Label Printed]="Yes"
 

Hydra427

Registered User.
Local time
Yesterday, 19:50
Joined
Mar 9, 2012
Messages
40
How about?
Code:
Me.[Label Printed]="Yes"
Do I add that to the print button code or the test box code?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:50
Joined
Oct 29, 2018
Messages
21,474
Do I add that to the print button code or the test box code?
If you want the Textbox to change then you click on the button, you would add the code to your button.
 

Hydra427

Registered User.
Local time
Yesterday, 19:50
Joined
Mar 9, 2012
Messages
40
OK, I can get the text box to change but am having trouble figuring out how to print my report based on the current record in the form. I thought about using
DoCmd.RunCommand acCmdSelectRecord
DoCmd.printout acselection
But that does not pull in the report that I want to run which is "Box Label Report"

I also thought about using a macro to print the report but how would I add the Me.[Text Label]="Yes" to the Macro?

Thanks, John
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:50
Joined
Feb 19, 2002
Messages
43,293
If you want to store the fact that the report was printed at least once, add a new column to the table where you can save the information. Sometimes we want to control printing so the first printing of a form has no special marks but subsequent prints have a big REPRINT as a watermark or in some spot where it can't be easily hidden. If you want to track the number of times a report is printed, set the default of the field to 0. Then when you press the print button, use the DoCmd.OpenReport command to print and on the next line, increment the count field:

Me.PrintCount = Me.PrintCount + 1

You'll need to tell us why you need to do this because there are lots of options and we have no idea what to tell you about.
 

Users who are viewing this thread

Top Bottom