need report help! thanks guys - simple i am sure for you!

S

sbshelp

hey - i have a button on a form that opens a report. when i click that
button it seems as tho the report gets printed!
i want to open a report by clicking a button without printing - just view on
screen.
is that possible?
thanks!
 
R

Rick Brandt

sbshelp said:
hey - i have a button on a form that opens a report. when i click that
button it seems as tho the report gets printed!
i want to open a report by clicking a button without printing - just view on
screen.
is that possible?
thanks!

Look at the code for your button. It will be using the OpenReport method of
DoCmd. The second (optional) argument for that method controls this. It
defaults to acViewNormal. You need to use acViewPreview instead.
 
T

Tom Wickerath

Yes, it is. Here are a couple of examples:

Unfiltered report:
DoCmd.OpenReport ReportName:="rptEmployees", View:=acPreview

Filtered report:
DoCmd.OpenReport ReportName:="rptEmployees", View:=acPreview, _
WhereCondition:="EmployeeID = " & Me.cboSelectEmployee


where "rptEmployees" is the name of the report, and "cboSelectEmployee" is
the name of a combo box on the form, for the filtered report. Make the
appropriate substitutions.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

hey - i have a button on a form that opens a report. when i click that
button it seems as tho the report gets printed!
i want to open a report by clicking a button without printing - just view on
screen.
is that possible?
thanks!
 
W

WendyWest

Here is the code for behind your button:

Dim stDocName As String

stDocName = "rptReportName"
DoCmd.OpenReport stDocName, acPreview
 
Top