Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    global code (Access 2000)

    i want to build a function called "ClosetheForm" that could be called in any form to close this form
    The function should be the folloiwng

    Public Function "CloseTheForm"

    DoCmd.SetWarnings False
    DoCmd.Close acForm, "Form1"", acSaveNo"
    End Function

    The function should be valid not only for Form1, but for any other form in my database.How can i build the code so that i should not mention any special name of a form,and to be applicable
    to any form ?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 41 Times in 40 Posts

    Re: global code (Access 2000)

    >>Public Function "CloseTheForm"

    DoCmd.SetWarnings False
    DoCmd.Close acForm, "Form1"", acSaveNo"
    End Function<<

    Your function needs to be changed to this (also notice change in quotation)"

    Public Function CloseTheForm(strName as string)

    DoCmd.SetWarnings False
    DoCmd.Close acForm, strName, acSaveNo
    End Function

    I'm assuming you would call this function from a button on your form. In the Click event property, you will need this:

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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