Report within a form?

G

Guest

I want to make a form that has a window of some kind at the top, and below a
series of button, each associated with a particular report. When the user
clicks on a button, I'd like the corresponding report to display in the
window at the top of the form (I don't want the report to launch
full-screen). Is there a way to do this? Or must I just have each button
launch a report in full-screen version?

Thanks in advance,
Tim
 
G

Guest

Hi, Tim.

One cannot place a report in a subform control, if that's what you're
asking. However, one can open a report at a specific place on the screen and
at a specific size by using the report's Move( ) subroutine. Try:

Private Sub OpenRptBtn_Click()

On Error GoTo ErrHandler

Dim rpt As Report

Const INCH As Long = 1440

DoCmd.OpenReport "rptMyReport", acViewPreview
Set rpt = Reports("rptMyReport")
rpt.Move 0, 0, 6.5 * INCH, 3 * INCH

CleanUp:

Set rpt = Nothing

Exit Sub

ErrHandler:

MsgBox "Error in OpenRptBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Sub

.. . . where rptMyReport is the name of the report and it will be opened at
6.5 inches wide and 3 inches high at the top left corner of the screen.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
G

Guest

That is what I was asking, thanks for your response. Your proposed
alternative worked great though, thanks very much!

Tim
 

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