Switchboard Size

E

Erin

I have a switchboard that is set to be a small window and centered in the
middle of the screen. When you open a report and you choose to maximize that
report, the switchboard maximizes too. Is there any way to make the
switchboard stay that same, smaller size, no matter what the user does to
resize reports?

Thanks!!!
 
T

Tom Wickerath

Hi Erin,

You can use VBA code to automatically maximize reports, and then issue a
restore command when they close the report. Here are procedures for
Report_Activate and Report_Close. I also included a procedure for
Report_NoData. If you use the NoData procedure, you can prevent a report from
opening when the recordset has zero records. If you do so, make sure to trap
for error 2501 in the calling procedure.

Option Compare Database
Option Explicit

Private Sub Report_Activate()
On Error GoTo ProcError

DoCmd.Maximize

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Report_Activate..."
Resume ExitProc
End Sub

Private Sub Report_Close()
On Error GoTo ProcError

DoCmd.Restore

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Report_Close..."
Resume ExitProc
End Sub

Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ProcError

MsgBox "There is no data for the selected criteria.", _
vbInformation, "No Data Available..."
Cancel = True

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Report_NoData..."
Resume ExitProc
End Sub


There is also a "lightweight" means of accomplishing the same goal (maximize
and restore), where you use code in a stand-alone module, and expressions in
the report's property sheet. There is an example on the FMS web site, which I
can track down if you are interested. Otherwise, put the above code into each
report.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 

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