Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Cheltenham, Gloucestershire, England
    Thanked 0 Times in 0 Posts

    automatically close a linked form (2000)

    I have a form where I select a customer and then select a button to open another form at the selected customer using the following (Created by using the wizard!):
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "(a) Add new Clients"

    stLinkCriteria = "[Crissp]=" & Me![Combo2]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Ideally I would like to close the first form - but I realise that closing the first form using


    before opening the other will lose the connection between the two text boxes and therefore gives me an error message.

    How can I close the first form and still pick up the required informatiion for the syncronisation - otherwise I find myself left with a series of forms open as I have a number of similar type menu forms.



  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: automatically close a linked form (2000)

    You can close the "calling" form after opening the "called" form. DoCmd.Close wothout further specification will close the active form, so if you invoke it after opening the "called" form, the "called" form will be closed again. But you can specify which form is to be closed:

    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.Close acForm, Me.Name

    "Me" refers to the form that is executing the code, that is the "calling" form, so Me.Name is the name of the "callling" form.

Posting Permissions

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