Stupid Report Question

mlh407

Registered User.
Local time
Today, 05:51
Joined
Jun 24, 2005
Messages
26
I want to place a button on a form, that will call a report with a where clause on it (to limit it to the record on the form, print that report, then return to the form.

I know some VB, but not much, how hard is this?

Mike
 
DoCmd.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
 
Kinda

That does not print the report. It sets it up to preview.
 
Did you look up OpenReport in the VBA help system?

Code:
Dim stDocName As String, stLinkCriteria As String
stDocName = "rptPriceChange"
stLinkCriteria = "[ProductID]=" & [ProductID]
DoCmd.OpenReport stDocName, acViewNormal , , stLinkCriteria, , acDialog
 
That works for me, but the issue is it just displays the report, I want to open the report as above, (that much I have done) then print the report, then close the report window so they are back on the form. It can print to the default printer.
 
Code:
    DoCmd.PrintOut
    Docmd.Close acReport, "Report Name"
 
Modest your code is not correct for mlh407's needs, RuralGuy gave him the correct answer ;)
 

Users who are viewing this thread

Back
Top Bottom