Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.0 SP

    I have a Single Form frm_CR_ACD where I add new complaint records using a Add button to go into new record mode

    I then enter the address of the new complaint

    If a new complaint is added and there is already one or more on file for the same address, I notify the operator and display all the complaints on file for that address in a datasheet form frm_CR_Duplicates showing partial information including complaint number, date, owner, etc.

    Everything works OK up to this point

    The frm_CR_Duplicates field complaint number has the following code in the on click event

    If the operator needs more information on the complaint I want to be able to click on frm_CR_Duplicates complaint number and populate frm_CR_ACD with the full complaint information

    <pre>Dim strSQL As String
    strSQL = "SELECT * FROM tblCRMaster WHERE lngCRMasterID = " & Me.lngCRMasterID

    DoCmd.OpenForm "frm_CR_ACD", WindowMode:=acHidden
    Forms!frm_CR_ACD.RecordSource = strSQL
    Forms!frm_CR_ACD.Visible = True
    </pre>


    The above code works, however I loose the original complaint that I started in the original frm_CR_ACD instance

    I need to open a second instance of frm_CR_ACD from frm_CR_Duplicates to review prior complaints then return to first instance of frm_CR_ACD and decide to either go forward with the new complaint or cancel the complaint the was just started.

    Thanks, John

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

    Re: Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.

    You can use code like this:

    Dim frm As Form
    Set frm = New Form_frm_CR_ACD
    frm.RecordSource = strSQL
    frm.SetFocus

    This will only work if frm_CR_ACD is already open.

    See ACC2000: How to Open Multiple Instances of a Form for general info.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.

    Great stuff!

    I added:

    --------------------------
    'Increment instance number
    intInstanceNum = intInstanceNum + 1

    'Change caption of new form
    frm.Caption = "Multiple Instances of Form (" & intInstanceNum & ")"
    --------------------------

    The frm_CR_ACD form has ADD, EDIT, DELETE and CLOSE butons

    When I

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

    Re: Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.

    Are these three separate questions? Keeping track of intInstanceNum is probably best. If you pass OpenArgs to the first instance, it is passed to the new instances too.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.

    Hans

    I used intInstanceNum to determine which frm_CR_ACD instance is was in, everythings working OK

    For future reference how would I pass a open argument when opening frm_CR_ACD from frm_CR_Duplicates (the ist instance?)

    Thanks for your help

    John

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

    Re: Help With Opening Second Instance of Form? (a2k (9.0.6926) SP-3 Jet 4.

    DoCmd.OpenForm FormName:="frm_CR_ACD", OpenArgs:="whatever you want to pass"

    Click in OpenForm (in the Visual Basic Editor) and press F1 for more info about the syntax of OpenForm.

Posting Permissions

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