Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Report from Form button 1

Status
Not open for further replies.

drewson

MIS
Jun 3, 2003
50
US
I want to have a button on my form that prints off a report. I've figured out to use this line of code to just print it to the default printer:

stDocName = "RepairOut"
DoCmd.OpenReport stDocName, acViewNormal

But I want the printer dialog to come up so I can let the user select the printer. Any ideas?

Thanks.
 
DoCmd.OpenReport stDocName, acViewPreview

Then, when you select print from the file menu, your printer dialog will come up.
 
Hi

I'd be interested to know your results on this problem as I have just posted a thread elsewhere for a very similar problem.

I want to print a Single Record from a Form in a Report

Ken
 
if you want to print a single record, wizzweb, you could just use the docmd.openreport, but set the wherecondition parameter to a value that is unique for the record you want to print, that way only that record would appear in the report.

drewson and wizzweb,
There is a post in this forum from awhile back outlining a procedure for making the printer dialog come up without having to use acviewpreview, I'll try to track it down.
 
Use a WHERE condition.....

Dim strCondition as String
strCondition = "FieldName = '" & me.txtName & "'" (if txtName is text)
OR
strCondition = "FieldName = " & me.txtAge (if txtAge is a number)
DoCmd.OpenReport stDocName, acViewPreview,,strCondition
 
this article has all the info you'll want,

thread702-672044

and this one is a little less in depth

thread702-675417
 
Hi All

Thanks alot for the tips. Read back on the old archives, so I wil try them out. Hopefully one day I will get it sorted.

ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top