Link to home
Create AccountLog in
Avatar of Lele Brown
Lele Brown

asked on

Print Open Access report to PDF

I have a Access Report that the user opens from a form in Report View. I have a Print button on this report to save it to a PDF. I want to make the Print button invisible on the PDF so I say cmdPrint.visible = false. I get an error saying that I can't make a control that has focus invisible. I have tried setting something else on the report to focus using setfocus but I get an error saying method or data member not found.  If I just print to the PDF from the report it works but the Print button shows up.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
you can NOT set the visible property of the control when it has the focus,
set the focus to another control before setting the visible property of the button to false

me.othercontrolname.setfocus
me.cmdPrint.visible = false
Avatar of Lele Brown
Lele Brown

ASKER

Thanks. That worked.
Hi LeLeBrown, I am brand new to Access and need to save a report to the desktop as a PDF from the entry form and need to save the current record in the report.  It sounds like you have been able to do this?  Would you please share the code you used?  Thank you in advance for any assistance.  Marc
I am sorry but I didn't see this until now. Do you still need help?
LeLeBrown, thank you for asking but I have figured it out now.  Thanks and have a great day!