Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231

    Unanswered: Opening multiple instances of graph at same time, but tricky...

    i know how i would open multiple instances of a graph that i was sure was going to be opened -
    Code:
    Set gphNew = New Form_gphWhatever
    . But would it be possible to do something like that when the object name to be opened is stored in a variable? For example, at the end of the code, the variable strGraph may hold the name "gphSQLOld" or "gphSQLNew"
    any way that i could accomplish a
    Code:
    Set gphNew = New "Form_" & strGraph
    Obviously the above does not work. I did that kind of stuff with the preprocessor in C, but have no clue how to accomplish this in VBA. thanks for looking. have a great week

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1

    Arrow

    Hi

    I not sure I know anything about graphs in Access, but on the basis that this

    Form_gphWhatever

    is a form, then you could try using the Forms collection, something like:-

    Code:
        Dim gphNew As New Form
        Dim strGraph As String
        
        strGraph = "YourFormName" 'variable set in the program !
        
        Set gphNew = Forms(strGraph)
        
        MsgBox gphNew.Caption ' test to see if it works !
    Is that what you had in mind ??


    MTB
    Last edited by MikeTheBike; 06-14-06 at 09:14.

  3. #3
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    Looks great...but doesn't work for me. Gives me a
    Interface can't find the form 'gphSumWeightsOLD' referred to in a macro expression or Visual Basic code.
    I think because I'm trying to Set the object to the form, which hasn't been opened yet.
    I ALWAYS forget about collections. Thanks for the help. I think it's a step in the right direction. Have a good one.
    Last edited by jmahaffie; 06-14-06 at 09:46.

Posting Permissions

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