multiple users

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ken

    #1

    multiple users

    Is there a way to check if access has not been used for say 10 minutes
    and then to close the front end? I was just thinking that that might be
    a good idea since a lot of people like having their frontends alway
    open and that is not good...

  • Rick Brandt

    #2
    Re: multiple users

    ken wrote:[color=blue]
    > Is there a way to check if access has not been used for say 10 minutes
    > and then to close the front end? I was just thinking that that might
    > be a good idea since a lot of people like having their frontends alway
    > open and that is not good...[/color]

    It can be done, but it's not trivial because there is no built in method for
    detecting "idle time". You could have a hidden form with a Timer event and
    when certain events happen you could reset that Timer. The problem is you
    would have to reset that Timer in EVERY possible event to be able to tell if
    the user was not doing anything.

    If you are satisfied with only resetting the timer on fewer more significant
    events (opening a form or report, saving a record, etc.), then it becomes
    more practical, but you also run the risk of closing the app when the user
    is really doing something that you were not monitoring.

    --
    I don't check the Email account attached
    to this message. Send instead to...
    RBrandt at Hunter dot com


    Comment

    • ken

      #3
      Re: multiple users

      ok what about...the posibility of one front end finding out who is
      using the record that they are on...or maybe a way to identify in front
      ends who is using the database?

      Comment

      • Br@dley

        #4
        Re: multiple users

        ken <gevayl@gmail.c om> wrote:[color=blue]
        > ok what about...the posibility of one front end finding out who is
        > using the record that they are on...or maybe a way to identify in
        > front ends who is using the database?[/color]

        This code builds a list of computer names that are currently connected
        to the backend. Users of a system I use this in can still have the
        program open at the first switchboard as there is no data access at that
        time.

        On Error GoTo GetCurrentUsers _err
        Dim cn As New ADODB.Connectio n
        Dim cn2 As New ADODB.Connectio n
        Dim rs As New ADODB.Recordset
        Dim i, j As Long, ds As String
        Dim ComputerName As Variant, UserName As Variant
        DoCmd.SetWarnin gs False
        DoCmd.RunSQL "DELETE * FROM appCurrentUsers ;"
        DoCmd.SetWarnin gs True
        ds = GetDataLocation () ' a function a returns the path to the backend
        database
        cn.Provider = "Microsoft.Jet. OLEDB.4.0"
        cn.Open "Data Source=" & ds
        'cn2.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" _
        & "Data Source=" & ds
        Set rs = cn.OpenSchema(a dSchemaProvider Specific, _
        , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
        Dim rsOut As DAO.Recordset
        Set rsOut = CurrentDb.OpenR ecordset("appCu rrentUsers",
        DB_OPEN_DYNASET )
        With rsOut
        While Not rs.EOF
        UserName = Trim(rs.Fields( 1))
        UserName = Left(UserName, Len(UserName) - 1)
        ComputerName = Trim(rs.Fields( 0))
        ComputerName = Left(ComputerNa me, Len(ComputerNam e) - 1)
        .AddNew
        If UserName = "Admin" Then
        ![UserName] = CurrentUser
        ![Computer] = ComputerName & " (local)"
        Else
        ![UserName] = UserName
        ![Computer] = ComputerName
        End If
        ![Connected] = rs.Fields(2)
        ![SuspectState] = rs.Fields(3)
        .Update
        rs.MoveNext
        Wend
        End With

        --
        regards,

        Bradley

        A Christian Response



        Comment

        • Br@dley

          #5
          Re: multiple users

          ken <gevayl@gmail.c om> wrote:[color=blue]
          > ok what about...the posibility of one front end finding out who is
          > using the record that they are on...or maybe a way to identify in
          > front ends who is using the database?[/color]

          This code builds a list of computer names that are currently connected
          to the backend. Users of a system I use this in can still have the
          program open at the first switchboard as there is no data access at that
          time.

          On Error GoTo GetCurrentUsers _err
          Dim cn As New ADODB.Connectio n
          Dim cn2 As New ADODB.Connectio n
          Dim rs As New ADODB.Recordset
          Dim i, j As Long, ds As String
          Dim ComputerName As Variant, UserName As Variant
          DoCmd.SetWarnin gs False
          DoCmd.RunSQL "DELETE * FROM appCurrentUsers ;"
          DoCmd.SetWarnin gs True
          ds = GetDataLocation () ' a function a returns the path to the backend
          database
          cn.Provider = "Microsoft.Jet. OLEDB.4.0"
          cn.Open "Data Source=" & ds
          'cn2.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" _
          & "Data Source=" & ds
          Set rs = cn.OpenSchema(a dSchemaProvider Specific, _
          , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
          Dim rsOut As DAO.Recordset
          Set rsOut = CurrentDb.OpenR ecordset("appCu rrentUsers",
          DB_OPEN_DYNASET )
          With rsOut
          While Not rs.EOF
          UserName = Trim(rs.Fields( 1))
          UserName = Left(UserName, Len(UserName) - 1)
          ComputerName = Trim(rs.Fields( 0))
          ComputerName = Left(ComputerNa me, Len(ComputerNam e) - 1)
          .AddNew
          If UserName = "Admin" Then
          ![UserName] = CurrentUser
          ![Computer] = ComputerName & " (local)"
          Else
          ![UserName] = UserName
          ![Computer] = ComputerName
          End If
          ![Connected] = rs.Fields(2)
          ![SuspectState] = rs.Fields(3)
          .Update
          rs.MoveNext
          Wend
          End With

          --
          regards,

          Bradley

          A Christian Response



          Comment

          Working...