Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using the 'Tag' to close other forms down (2000)

    Hi,

    I recall during my training days about using the 'Tag' section in a forms properties so that when you open another form in the 'on open' event you could have it search for all the other forms that are open with the same tag number would close down excpet the one you are trying to open at that moment in time?

    Any ideas?
    Best Regards,

    Luke

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

    Re: Using the 'Tag' to close other forms down (2000)

    The Tag property of a form and of controls has no intrinsic meaning. From the built-in help:
    <hr>You can use the Tag property to store any extra information about a form, report, data access page, section, or control needed by your application.

    Setting

    You can enter a string expression up to 2048 characters long. The default setting is a zero-length string (" ").<hr>
    So it's up to you as designer/programmer to assign a meaning to the Tag property.

  3. #3
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using the 'Tag' to close other forms down (2000)

    I want to be able to set it so that it looks at all the other tags on the open forms and closes the others down that match the one it's opening, any clues on the code?
    Best Regards,

    Luke

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

    Re: Using the 'Tag' to close other forms down (2000)

    Try this:
    <code>
    Private Sub Form_Open(Cancel As Integer)
    Dim i As Integer
    Dim frm As Form
    For i = Forms.Count - 1 To 0 Step -1
    Set frm = Forms(i)
    If frm.Tag = Me.Tag And Not frm Is Me Then
    DoCmd.Close acForm, frm.Name
    End If
    Next i
    Set frm = Nothing
    End Sub</code>

Posting Permissions

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