Results 1 to 3 of 3
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Passing Multiple Open Arguments (A2K SR1)

    I need to open a form and pass multiple open arguments at the same time. The form being opened is launched from another form. I can't get the syntax correct. The below code opens the form and passes the arguments after the form is opened. What would the open argument statement look like to pass the open arguments in the Docmd.open....

    'FORM MS GRAPHICS ALL
    'Open Form - MS Graphics All

    STRFORMNAME = "FORM - MS GRAPHICS ALL"
    DoCmd.OpenForm STRFORMNAME, acNormal

    'Set ClinSlin selection on Opened Form
    Forms(STRFORMNAME)!SelectClinSlin.Value = C 'THIS IS THE FIRST OPEN AGRUMENT
    Pause (1) ' Pauses are used to allow the form to calculate

    'Select Milestone
    MSNAME = "Complete cGMP Pilot Lot Mfg."

    'Set Graph View to Current Milestone
    Forms(STRFORMNAME)!SelectMilestone.Value = MSNAME 'THIS IS THE SECOND OPEN ARGUMENT
    Pause (2)
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passing Multiple Open Arguments (A2K SR1)

    There are several ways to handle this, including using OpenArgs, which is probably the simplest. If you know the values of the two arguments before you open the form, simply concatenate the two values into a string with a semicolon separating the two values, like this:

    strArgs = "first arg;second arg"

    Then open the form like this:

    DoCmd.OpenForm, acForm, acNormal, , , , , strArgs

    In the open event of the form you just opened, parse out the two arguments something like this:

    strArg1 = Left(Me.OpenArgs, InStr(Me.OpenArgs, ";") -1)
    strArg2 = Mid(Me.OpenArgs, InStr(Me.OpenArgs,";")+1)
    Charlotte

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Passing Multiple Open Arguments (A2K SR1)

    Thanks Charlotte,

    I will give this a try.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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