Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Location
    Massachusetts, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print Report and Close Forms (2002 (XP))

    I am trying to add some code to a button that prints a report. What I want to happen is to have the user click the print button and have the form print then have it automatically close all the open forms and leave just the switchboard open. My code isn't working here it is. Think I am just naming the forms wrong.

    Private Sub Command82_Click()
    On Error GoTo Err_Command82_Click

    Dim stDocName As String

    stDocName = "Main Table"
    DoCmd.OpenReport stDocName, acNormal
    DoCmd.Close , Form![PSTP1]
    DoCmd.Close , Form![PSTP2]
    DoCmd.Close , Form![PSTP3]

    Exit_Command82_Click:
    Exit Sub

    Err_Command82_Click:
    MsgBox Err.Description
    Resume Exit_Command82_Click

    End Sub

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Report and Close Forms (2002 (XP))

    Give this bit of code a try:

    DoCmd.Close acForm, "PSTP1"

    and repeat it for the other form names.
    Hope that helps.

Posting Permissions

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