Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: Forms Collection

    Where can I go to Forms Collection?

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8

    Don't Unstand But

    first we need to

    dim ctl As Control

    then

    we can Loop all the Control on a Form

    For Each ctl In Me.[SHOW_SCREEN].Controls

    If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acCommandButton Then

    If ctl.Tag = whoo Then ' can log in person see this control
    ctl.Visible = True
    else
    ctl.Visible = False
    End if

    Else

    End if

    Next

    I run this on the ontimer event then I set the timer event back to 0 finish
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Sep 2005
    Posts
    313
    Ok, where do I paste these code? In modules, or what environment?? Sorry, I am a MS Access.

    Please let me know, thanks a lot. Thanks.

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    Think Every thing in MSaccess is a object

    And With That we can put An EVENT onto that object
    (Macro or vba or ...)

    So We need to think of the timing we want this Event to happen

    so..

    Onload yes but can't as the onload event run to ealry before some other object have loaded

    timing is the problem

    We have a pick of

    Form_OnLoad Event
    Form_OnOpen Event
    Form_Active Event
    Form_OnCurrent Event
    Form_Timer

    With The Above Code from Last Post
    I had Put it in the Form_Timer Event
    but set the TimerInterval = 1

    this gave the form time to load

    so
    Code:
    Private Sub Form_timer()
    Call Form_Current
    Call EDITIT  '<============this call the Control bit
    DoCmd.GoToControl "id"
    Me.[SHOW_SCREEN].Visible = False
     Me.TimerInterval = 0
    End Sub
    ..
    ...
    ...
    ..
    Code:
    Sub EDITIT()
    '***************************
    ' This look at each control on the form
    'base on the person login
    ' User        only see user  
    ' Manager   only see user manager 
    ' Admin      only see user manager admin
    '****************************
    ' Each object in the form had it Tag full in with its level 
    ' who is seeing it
    '****************************
    Dim frm As Form, ctl As Control
    Dim whoo As String
      Set ctl = Screen.ActiveControl
          If Me.SHOW_SCREEN.Visible = True Then
    '         Me.SHOW_SCREEN
    whoo = Who
    If whoo = "Personnel Assistants" Then whoo = "Manager"
        If isadmin Then
        Me.ShortcutMenuBar = ""
        Else
        Me.ShortcutMenuBar = "=1"
        End If
            For Each ctl In Me.[SHOW_SCREEN].Controls
           If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acCommandButton Then
                If ctl.Tag = whoo Then
                  ctl.Visible = True
                Else
                '  ctl.Visible = False
                End If
                If IsNull(ctl.Tag) Or Len(ctl.Tag) < 1 Then ctl.Visible = True
                If Who = "Admin" Then
                    ctl.Visible = True
                Else
                
                End If
                If ctl.Tag = "Hide" Then ctl.Visible = False
                Else
                End If
        Next ctl
    '      Me.AllowFilters.AllowFilters = isadmin
    Else
    End If
    Me.SHOW_SCREEN.LinkMasterFields = ""
    Me.SHOW_SCREEN.LinkChildFields = ""
    Me.SHOW_SCREEN.LinkMasterFields = "Event ID"
    Me.SHOW_SCREEN.LinkChildFields = "Event ID"
    Me.AllowEdits = isadmin
    Me.Recalc
    End Sub
    this bit of code is about 6 year old it works for me
    I lost data trying to lean microsoft database workgroups
    so this was my Security
    what the User could'nt see they could't break
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  5. #5
    Join Date
    Sep 2005
    Posts
    28
    So, If I have 2 forms , they are related each other

    Input Form, and Check Form

    I put the codes in the timer event of Input Form, and Check Form, right. Then it will work each other.

    Thanks a lot. Thanks. Thanks.

  6. #6
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    yeap

    I don't know what would happen to the inactive form

    you can let me know

    think what mite happen
    is when the inactive form comes active doing it this
    the active has now come inactive

    so some thinking needs to done on that bit
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

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