Set Value when Printing using VBA button

tim1982

Registered User.
Local time
Today, 05:55
Joined
Feb 18, 2009
Messages
21
Hello,

I have a button in my form to print work orders... I'm trying to have a selection box below the print button be automatically checked once I print.

I've tried adding a "set value" in VBA below the printing code, but that didn't work.... I've also tried "setvalue" in a separate macro, but "setvalue" wouldn't even show up as a macro option.

If anyone has a suggestion, please respond. I'll add more details if necessary...

USING ACCESS 2007. EXTREME NEWB APPRECIATES ANY HELP.

Thanks,

Tim
 
In VBA it would look like:

Me.CheckBoxName = True
 
Thanks for the quick response, pbaldy.

I tried what you said and it gave me another error I've been getting that tells me the VBA function is improper.

This is what I tried....

Private Sub PrintWorkOrders_Click()

DoCmd.OpenReport "WorkOrders", PrintOut, , _
"[OrderID]=Forms![Enter/Edit Orders].[OrderID]"
Me.Forms![Enter/Edit Orders].[WorkOrderPrint] = True

End Sub

I'm not sure how to add another line to this VBA function and have it work properly.

Any help appreciated. Thanks.
 
You want "Me..." or "Forms!...", not both. If the checkbox is on the same form as this code, use

Me.[WorkOrderPrint] = True

Otherwise

Forms![Enter/Edit Orders].[WorkOrderPrint] = True
 
No problem. By the way, it's generally not a good idea to have spaces or symbols in your names. They force you to use the brackets among other things.
 
Yeah, I try to follow that rule. The [Enter/Edit Orders] has a space because I wanted it to display as that name.... I'll try to avoid this in the future.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom