Results 1 to 8 of 8

Thread: Simple Question

  1. #1
    Join Date
    Jul 2003
    Posts
    18

    Unhappy Unanswered: Simple Question

    I would like to open a report through a click on a command button from another from. The command button open the report but it prints it also!!!
    Is this normal because I just want to open the report?

    Here is the code for the command button:

    Private Sub cmdCompany_Click()

    DoCmd.OpenReport "Companies Report"

    End Sub


    Thanks for the help

    PS: I'm looking also to avoid having the bebug window poping up when I cancel the event which is opening the report

  2. #2
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    In order to ' view' the report before printing it:

    Private Sub cmdCompany_Click()

    DoCmd.OpenReport "Companies Report" acNormal

    End Sub

    hope this helps!

    Marco

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Just to clarify:
    acViewPreview opens the report in print preview.
    acViewNormal prints the report.
    Inspiration Through Fermentation

  4. #4
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139

    Cool

    I like precise people

  5. #5
    Join Date
    Jul 2003
    Posts
    18

    Thumbs up

    Thanks for the help guys it's working now.

    I was also looking to stop the debugging window from poping up when I cancel the action of opening the report. It there way to do it?

    Private Sub cmdCompany_Click()

    DoCmd.OpenReport "Companies Report" acViewPreview

    End Sub

  6. #6
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    Sorry if I've been posting the 'wrong' answer. And thanks to RedNeckGeek for the correction.

    Now we go for your problem, and try this

    Private Sub cmdCompany_Click()
    On Error GoTo cmdCompany_Click

    DoCmd.OpenReport "Companies Report" acViewPreview

    Exit_cmdCompany_Click:
    Exit Sub

    Err_cmdCompany_Click:

    Resume Exit_cmdCompany_Click

    End Sub
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  7. #7
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    Sorry: to be precise!

    Private Sub cmdCompany_Click()
    On Error GoTo Err_cmdCompany_Click

    DoCmd.OpenReport "Companies Report" acViewPreview

    Exit_cmdCompany_Click:
    Exit Sub

    Err_cmdCompany_Click:

    Resume Exit_cmdCompany_Click

    End Sub
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  8. #8
    Join Date
    Jul 2003
    Posts
    18

    Lightbulb

    It's working thanks. There is no reason to be sorry. Precision is perfection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •