Open multiple instances of a form in MS Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ColinPearson
    New Member
    • Feb 2007
    • 3

    Open multiple instances of a form in MS Access

    Is there any way to open mulitple instances of a form in Access? I need my form to be active and open 3 or 4 times during the same session. The only thing I can think of is creating the form everytime. Is there an easier way?
    Thanks,
    Colin
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi Colin. Can you describe your problem in terms that are not your solution? i.e. My problem is x, y, z. Not I need to have multiple instances open because that is the answer to my problem and I only need to find out how to implement this. The answer to your problem might be much simpler than you think

    Comment

    • ColinPearson
      New Member
      • Feb 2007
      • 3

      #3
      I am creating a database for security traders in a financial company. I have created a form that allows the trader to input the number of shares, price, etc... One of those basic no-brainer forms. What I am looking to do is allow the traders to start one trade, leave the form open and start a new trade using the same form but allow each form to operate independantly. Any ideas?

      Comment

      • willakawill
        Top Contributor
        • Oct 2006
        • 1646

        #4
        What is this process 'start a trade'?

        Comment

        • ColinPearson
          New Member
          • Feb 2007
          • 3

          #5
          Starting a trade would involve pulling up the "Create a new Trade" form then punching in the relavant data ie. price, quantity, etc.
          However the time between starting a trade and finishing a trade could be half an hour or so. I would like the traders to be able to leave their original "Create a new Trade" form open while calling up a second instance of the "Create a new Trade" form and start a new trade.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by ColinPearson
            Is there any way to open mulitple instances of a form in Access? I need my form to be active and open 3 or 4 times during the same session. The only thing I can think of is creating the form everytime. Is there an easier way?
            Thanks,
            Colin
            An Access Form is nothing more than a Class, and as such new Instances of it can be created. The following code will create 4 New Instances of a Form named frmTest, place them in a Public Array declared as frmTest, Cascade the Form Windows, then make frmTest the Current Form. All this is accomplished via the Click() Event of a Command Button on frmTest. BTW, each Form Instance can de identified by its Caption. Good Luck.
            Code:
            'Public Array to hold Form Instances
            Public MyFormCollection(1 To 4) As Form_frmTest
            Code:
            Private Sub Command15_Click()
            Dim intCounter As Integer
            
            For intCounter = 1 To 4
               Set MyFormCollection(intCounter) = New Form_frmTest
               MyFormCollection(intCounter).Visible = True
            
               MyFormCollection(intCounter).Caption = "Form #" & intCounter
            
               DoCmd.RunCommand acCmdWindowCascade
            Next intCounter
            
            Forms!frmTest.SetFocus
            End Sub

            Comment

            • willakawill
              Top Contributor
              • Oct 2006
              • 1646

              #7
              OK. This is why I wanted in on the 'problem' rather than the fix. Would life not be simpler if each new trade appeared in a listbox and could be clicked to close it?

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32634

                #8
                I think I see where you're going with this one Will, but unless the trades are very simple then I think the multiple instance solution may prove the most practical. I've never had to use it myself and it's a little complicated to set up certainly, but for the operator to select an open trade and update the details I think multiple forms would be required.

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #9
                  I would also think you would want to set Data Entry to yes. I don't know how updates to the table would affect each other.

                  Comment

                  Working...