guru buster

F

Frank

I have an access 2002 database
I have an entry form in it
I have a command button that opens a report on it and reflects filtered
results.

What I want to do is this:

When clicking the report command button, I want the report to maxiuxm and
open to 115%.

I use the following code:


Function aadPreviewReport(frm As Form)
On Error GoTo Err_SmartFormError

Dim strReportName As String, strSQL As String
strSQL = "[" & stFormDataSource & "].[" & stFilterField & "] = Forms.["
& frm.Name & "].cmbFilterValue"

If IsNull(frm.cmbReports.Value) Or frm.cmbReports.Value = "" Then
Beep
Exit Function
Else
strReportName = frm.cmbReports
End If

If frm.tglFilter = True Then
DoCmd.OpenReport strReportName, acViewPreview,
Reports(strReportName).ZoomControl = 115, strSQL
Else
strSQL = vbNullString
DoCmd.OpenReport strReportName, acViewPreview,
Reports(strReportName).ZoomControl = 115, strSQL
End If


Any assitance is greatly appreciated.
 
R

Rob Parker

Hi Frank,

To force the report to maximize, put the following line in the report's Open
event:
DoCmd.Maximize

To prevent all other windows within Access from remaining maximized when the
report is closed, you will need to put
DoCmd.Restore
in the report's Close event.

You can put these in the report's Activate and Deactivate events if the
users are likely to switch between windows while the report is open in
preview mode.

To set a preset zoom factor when the report opens, use
DoCmd.RunCommand acCmdZoomXXX
where XXX is one of the following: 10, 25, 50, 75, 100, 150, 200, 500, 1000
(those values from Access 2002 - may differ in other versions). This code
should be placed in the calling routine, after the DoCmd.OpenReport line; it
will not work in the report's Open event.

Notice that the 115% which you want is not available; if you need to use a
custom value, see
http://www.mvps.org/access/reports/rpt0020.htm

HTH,

Rob
 
F

Frank

Thanks a bunch George

I am testing your suggestions, having trouble with the command button with
filter code behind it. Will keep you updated as I go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top