Results 1 to 3 of 3
  1. #1
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52

    Question Getting my form to close when I close the Report

    I have to keep a date input form open In order to run a report correctly, so I just minimize the form. So I am trying to move the close for that form into the close event for the report, but it will only seem to close the report and leaves the form minimized in the corner.

    How can I get it to close both the form and the report, when I click on the close print preview button.

    I feel like I have put my close statement everywhere and it won't close it.

    Here is the code I currently have on my report close event. This is without any attempt to close the form.


    Code:
    Option Compare Database
    Private Sub Report_Close()
    If SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") > 0 Then
    DoCmd.Close
    If Forms!HomeScreen.Visible = False Then
    Forms!HomeScreen.Visible = True
    End If
    ElseIf SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") = 0 Then
    DoCmd.OpenForm "HomeScreen"
    End If
    End Sub


  2. #2
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    What is your form name you want to close?

    Add this piece of code at the end of your code:

    Code:
    DoCmd.Close acForm, "HomeScreen"
    HomeScreen is the form name in this example:

    hope this help.

  3. #3
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    Thanks that is what I was doing do I just kept forgetting the quotes around my form name

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-08-2011, 04:30 PM
  2. Report close problem after maximized
    By blueraincoat in forum Reports
    Replies: 5
    Last Post: 05-15-2011, 12:23 AM
  3. form won't save and close
    By Philislost in forum Access
    Replies: 6
    Last Post: 10-08-2010, 01:47 PM
  4. Close All but One Form
    By Bruce in forum Forms
    Replies: 4
    Last Post: 04-06-2010, 09:31 AM
  5. close form
    By taylorosso in forum Forms
    Replies: 5
    Last Post: 08-25-2009, 12:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums