Results 1 to 5 of 5
  1. #1
    Naot is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2013
    Posts
    3

    Multi istance form

    I need to open multi istance form.

    1) i have a table (SQL) "ActiveForm" which contains various fields including a field called "FormName" (Varchar (30)).
    2) in the access form called "Menu" i place a treeview control and when i "click" in the node, i read the table rsProcedure="SELECT .* FROM ActiveForm WHERE Active=true";

    3) Dim Istanzaform As Integer
    Dim dbs As Object
    Dim myFrm As AccessObject

    rsProcedure.MoveFirst

    rsProcedure.Find "DescrizioneForm = '" & Node.Text & "'", , adSearchForward

    If Not IsNull(rsProcedure("NomeForm")) Then



    Set dbs = Application.CurrentProject

    For Each myFrm In dbs.AllForms

    Debug.Print myFrm.Name

    If myFrm.Name = rsProcedure("NomeForm") Then

    ' Istanzaform = GetNewIstance(myFrm.Name) 'Return a free istance number (0 to 4)

    If Istanzaform > 4 Then Exit Sub 'too many istance opened

    Set NewIstance(Istanzaform) = new myfrm 'not work!
    NewIstance(Istanzaform).Tag = Istanzaform
    NewIstance(Istanzaform).Visible = True

    End If

    Next myFrm

    End If


    what wrong?

    Many thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What happens - error message, wrong results, nothing?

    Review http://allenbrowne.com/ser-35.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Naot is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2013
    Posts
    3
    Yes!
    user-defined type not defined. (?)

    I think the problem is that in my table I have the name of the form in the format string, while "Set NewIstance (Istanzaform) = New ...." expects the name of a form such as "Form_Procedura."

    Now, how do I convert a string into an object (Microsoft Access object classes) form called "Form_Procedura"?

    Bye

  4. #4
    Naot is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2013
    Posts
    3
    I see http://allenbrowne.com/ser-35.html but is the same problem.
    Function OpenAClient()
    'Purpose: Open an independent instance of form frmClient.
    Dim frm As Form

    'Open a new instance, show it, and set a caption.
    Set frm = New Form_frmClient -------------------------------------> in my project "Form_frmClient = form_Procedura = String"
    frm.Visible = True
    frm.Caption = frm.Hwnd & ", opened " & Now()

    'Append it to our collection.
    clnClient.Add Item:=frm, Key:=CStr(frm.Hwnd)

    Set frm = Nothing
    End Function

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I've never worked with custom collections.

    How many forms do you want to do this with?

    The only thing I can think of is conditional code to select the Set frm:

    Select Case rsProcedure("NomeForm")
    Case "formname1"
    Set frm = Form_formname1
    Case "formname2"
    Set frm = Form_formname2
    ...
    End Select
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-31-2012, 02:20 PM
  2. Multi Layer Form
    By macftm in forum Forms
    Replies: 4
    Last Post: 05-06-2012, 09:59 AM
  3. Multi Select Box in Form
    By SJ85 in forum Forms
    Replies: 1
    Last Post: 04-12-2012, 01:25 PM
  4. Multi-record form
    By dougie in forum Programming
    Replies: 2
    Last Post: 12-13-2011, 12:41 AM
  5. Multi Level Form
    By bkelly in forum Access
    Replies: 2
    Last Post: 08-28-2009, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums