Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Closing a form with VBA (2003)

    Hello,

    I am creating a switchboard with command buttons and combo boxes. I have it set up so when a command buttom is press a form will open up, however, I don't want the previous form to remain open. on what "Event" in the form do a put the VBA comand to close the previous form and what would the command be? Any help would be great. Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Closing a form with VBA (2003)

    You could put the code to close the switchboard form in the On Click code of the command button that opens another form:

    Private Sub cmdOpenAnotherForm_Click()
    ...
    DoCmd.OpenForm ...
    DoCmd.Close acForm, Me.Name
    ...
    End Sub

    <big>WARNING</big>: in the previous thread I helped you with, you open a form from the switchboard with a subform that is filtered by a value selected in a combo box on the switchboard form. If you close the switchboard form while the other form is open, the filter will not work correctly any more. So you should leave the switchboard open. Does it really bother you if the switchboard remains open?

  3. #3
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a form with VBA (2003)

    No it doesn't bother me. I could leave it open. Thanks for the "Warning". I will leave the form switchboard as is.

Posting Permissions

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