Small Challenge!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • perryche@yahoo.com

    #1

    Small Challenge!

    It is like a mountain to me, but I am sure it is nothing to many of
    your advanced Access Programmers here. Thanks for advance in helping
    me out.

    I need to do a "net send" command to active database users for a
    message.

    Is this possible with Access 2002?

    say, user9000 is login, I can send all active login database users a
    message sayin "the database will close in 1min".

    thanks again.
    Perry

  • Salad

    #2
    Re: Small Challenge!

    perryche@yahoo. com wrote:
    It is like a mountain to me, but I am sure it is nothing to many of
    your advanced Access Programmers here. Thanks for advance in helping
    me out.
    >
    I need to do a "net send" command to active database users for a
    message.
    >
    Is this possible with Access 2002?
    >
    say, user9000 is login, I can send all active login database users a
    message sayin "the database will close in 1min".
    >
    thanks again.
    Perry
    >
    Look at
    http://support.microsoft.com/kb/198755 to get a list of users in the app.

    I don't know if the UserRoster displays the Windows user id (it displays
    the machine name) or the login ID into the app. I suppose you could
    create a table and use the function at
    http://www.mvps.org/access/api/api0008.htm to stuff the user name and
    login time to the app.

    Ron Paii wrote to you on July 30th about NetSend.

    Comment

    • paii, Ron

      #3
      Re: Small Challenge!


      <perryche@yahoo .comwrote in message
      news:1186434264 .909809.91190@g 4g2000hsf.googl egroups.com...
      It is like a mountain to me, but I am sure it is nothing to many of
      your advanced Access Programmers here. Thanks for advance in helping
      me out.
      >
      I need to do a "net send" command to active database users for a
      message.
      >
      Is this possible with Access 2002?
      >
      say, user9000 is login, I can send all active login database users a
      message sayin "the database will close in 1min".
      >
      thanks again.
      Perry
      >
      I modified a function that reads the LDB file and returns a list of
      computers with that MDB open. I also added a Shell call to send a message to
      each computer.

      '---------------------------------------
      ' Open a .ldb file and get list of users
      ' Sends a message to each user
      ' returns a list format for an "IN" clause of a query
      '
      Public Function UserListMsg(DBN ame As String, strMessage as String) As
      String
      On Error GoTo UserListMsgErr
      Dim UserName As String, UserRight As String, UserList As String
      Dim ldbName As String
      Dim iNumUsers As Integer
      ldbName = Left(DBName, Len(DBName) - 4)
      ldbName = Trim(ldbName & ".ldb")
      iNumUsers = 0
      Open ldbName For Input Shared As #1
      Do While Not EOF(1)
      UserName = Input(31, #1)

      ' Send the message to computer
      Shell("NET SEND " & UserName & " """ & strMessage & """")

      iNumUsers = iNumUsers + 1
      UserRight = Input(5, #1)
      UserList = UserList & "'" & Trim$(UserName) & "',"
      Loop
      Close #1
      UserListMsg = UserList
      Exit Function
      UserListMsgErr:
      UserListMsg = ""
      If Err = 53 Then '.ldb file not found
      ElseIf Err = 62 Then
      Close #1
      Exit Function
      Else
      MsgBox Err.Number & " - " & Err.Description & ", Function: NumUsers"
      End If
      End Function


      Comment

      • paii, Ron

        #4
        Re: Small Challenge!


        "paii, Ron" <none@no.comwro te in message
        news:a6udnR2PPv g-_iXbnZ2dnUVZ_ty knZ2d@athenet.n et...
        >
        <perryche@yahoo .comwrote in message
        news:1186434264 .909809.91190@g 4g2000hsf.googl egroups.com...
        It is like a mountain to me, but I am sure it is nothing to many of
        your advanced Access Programmers here. Thanks for advance in helping
        me out.

        I need to do a "net send" command to active database users for a
        message.

        Is this possible with Access 2002?

        say, user9000 is login, I can send all active login database users a
        message sayin "the database will close in 1min".

        thanks again.
        Perry
        >
        I modified a function that reads the LDB file and returns a list of
        computers with that MDB open. I also added a Shell call to send a message
        to
        each computer.
        >
        '---------------------------------------
        ' Open a .ldb file and get list of users
        ' Sends a message to each user
        ' returns a list format for an "IN" clause of a query
        '
        Public Function UserListMsg(DBN ame As String, strMessage as String) As
        String
        On Error GoTo UserListMsgErr
        Dim UserName As String, UserRight As String, UserList As String
        Dim ldbName As String
        Dim iNumUsers As Integer
        ldbName = Left(DBName, Len(DBName) - 4)
        ldbName = Trim(ldbName & ".ldb")
        iNumUsers = 0
        Open ldbName For Input Shared As #1
        Do While Not EOF(1)
        UserName = Input(31, #1)
        >
        ' Send the message to computer
        Shell("NET SEND " & UserName & " """ & strMessage & """")
        >
        iNumUsers = iNumUsers + 1
        UserRight = Input(5, #1)
        UserList = UserList & "'" & Trim$(UserName) & "',"
        Loop
        Close #1
        UserListMsg = UserList
        Exit Function
        UserListMsgErr:
        UserListMsg = ""
        If Err = 53 Then '.ldb file not found
        ElseIf Err = 62 Then
        Close #1
        Exit Function
        Else
        MsgBox Err.Number & " - " & Err.Description & ", Function:
        NumUsers"
        End If
        End Function
        >
        >
        Sorry
        Shell("NET SEND " & UserName & " """ & strMessage & """")
        Should be
        Shell("NET SEND " & Trim$(UserName) & " """ & strMessage & """")


        Comment

        • perryche@yahoo.com

          #5
          Re: Small Challenge!

          Ron,
          Thank you so much.

          Perry

          Comment

          • perryche@yahoo.com

            #6
            Re: Small Challenge!

            Ron,
            Thanks for your help again. I haven't have a chance to try
            your method yet, but, I got one more question, does your codes send to
            all active database users? Or to any users in the network?

            Perry

            Comment

            • perryche@yahoo.com

              #7
              Re: Small Challenge!

              Ron,
              Never mind about my last question, but a more simplier one, how
              do I call a public function to run with a button?

              Perry

              Comment

              • Larry Linson

                #8
                Re: Small Challenge!

                <perryche@yahoo .comwrote
                Never mind about my last question, but a
                more simplier one, how do I call a public
                function to run with a button?
                If you are not going to do anything with the returned value, you can just
                put the function name preceded by an = sign in the Click event property of
                the Button Control. Or you can create a code snippet that calls the
                function.

                Larry Linson
                Microsoft Access MVP


                Comment

                Working...