Results 1 to 4 of 4

Close Form from Module

  1. #1
    tonere is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    22

    Close Form from Module


    I have a form (F_Finance_Budget) that users input data then hit a command button (which runs a module) to have that data placed in a holding table. I have found code that opens a message box. In this module, I would like the form to close if the user selects "Yes". The code I have below does not work. When I hover over the yellow highlighted "F_Finance_Budget" in debug, it says "F_Finance_Budget=Empty". Thank you all for your help in advance!

    Dim ReturnVal As Integer
    ReturnVal = MsgBox("Are you ready to update?", 35, "Update")
    If ReturnVal = vbYes Then
    DoCmd.Close acForm, F_Finance_Budget, acSaveNo
    End If

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,739
    The form name is a string argument. Try:

    DoCmd.Close acForm, "F_Finance_Budget", acSaveNo
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tonere is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    22
    That is the answer! Thank you so very much!

    WIJG, awesome.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,739
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Calling A Module Function To Open A Form
    By orcinus in forum Modules
    Replies: 3
    Last Post: 09-29-2010, 04:43 PM
  2. Replies: 3
    Last Post: 08-13-2010, 11:23 PM
  3. Track form and module design changes
    By c_smithwick in forum Modules
    Replies: 0
    Last Post: 05-11-2010, 10:28 AM
  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
  •  
Tech Forums: Microsoft Office Forums