Results 1 to 3 of 3
  1. #1
    Paintballlovr is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2013
    Posts
    96

    How to send system message to users


    I'm looking for some code to be able to send a popup or system message to a user connected to an access 2007 database. I know the computer name connected, but I'm not sure who or where it is. I already have a method for kicking everyone out of the database, but I really only want to use that when necessary. I would prefer to try a more gentle message request for them to disconnect first. Just so anyone responding knows, I'm not super proficient with banging out code, so if there is a solution and it's lengthy, I'll probably have to ask follow up questions. Thanks for any assistance.

  2. #2
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Within Access, it's probably easiest to set up the front end with a timer to check for messages. The back end would have a table that had a signal for impending shutdown, and the time it was going to happen.

    Also, if you pull the user and machine information at logon, you can log what user is logged on from what machine, and have the data to answer your own question. Here's a couple of routines I use at design time to pull user system data, to verify which items I want to use.
    Code:
    Public Function ShowUserNames() As String
      
      Debug.Print " * "
      Debug.Print " * **** STARTING USER NAMES EXTENDED ***** "
      Debug.Print " * "
      Debug.Print "NameUnknown          = " & GetUserNameExt(NameUnknown)
      Debug.Print " * "
      Debug.Print "NameFullyQualifiedDN = " & GetUserNameExt(NameFullyQualifiedDN)
      Debug.Print " * "
      Debug.Print "NameSamCompatible    = " & GetUserNameExt(NameSamCompatible)
      Debug.Print " * "
      Debug.Print "NameDisplay          = " & GetUserNameExt(NameDisplay)
      Debug.Print " * "
      Debug.Print "4                    = " & GetUserNameExt(4)
      Debug.Print " * "
      Debug.Print "5                    = " & GetUserNameExt(5)
      Debug.Print " * "
      Debug.Print " * **** MIDDLE USER NAMES EXTENDED ***** "
      Debug.Print " * "
      Debug.Print "NameUniqueId         = " & GetUserNameExt(NameUniqueId)
      Debug.Print " * "
      Debug.Print "NameCanonical        = " & GetUserNameExt(NameCanonical)
      Debug.Print " * "
      Debug.Print "NameUserPrincipal    = " & GetUserNameExt(NameUserPrincipal)
      Debug.Print " * "
      Debug.Print "NameCanonicalEx      = " & GetUserNameExt(NameCanonicalEx)
      Debug.Print " * "
      Debug.Print "NameServicePrincipal = " & GetUserNameExt(NameServicePrincipal)
      Debug.Print " * "
      Debug.Print " * **** ENDING USER NAMES EXTENDED  ***** "
      Debug.Print " * "
      Debug.Print " * "
      Debug.Print " * **** STARTING ENVIRON INFORMATION ***** "
      Debug.Print " * "
      Debug.Print " USERID              = " & Environ("UserID")
      Debug.Print " * "
      Debug.Print " USERNAME            = " & Environ("Username")
      Debug.Print " * "
      Debug.Print " COMPUTERNAME        = " & Environ("Computername")
      Debug.Print " * "
      Debug.Print " USERPROFILE         = " & Environ("Userprofile")
      Debug.Print " * "
      Debug.Print " HOMEPATH            = " & Environ("Homepath")
      Debug.Print " * "
      Debug.Print " OS                  = " & Environ("OS")
      Debug.Print " * "
     
      ShowUserNames = "DONE"
    End Function
    Function ShowEnvironmentVariables()
    Dim EnvString, Indx, Msg, PathLen    ' Declare variables.
    Dim varRet As Variant
      
        varRet = SysCmd(acSysCmdAccessVer)
        Debug.Print " * "
        Debug.Print " * *** ACQUIRING ACCESS VERSION  *** * "
        Debug.Print " * "
        Debug.Print " * Your MS Access Version Is " & Application.Version
        Debug.Print " * Your MS Access Syscmd Version Is " & varRet
        Debug.Print " * V11.0 is 2003, V12.0 is 2007, V14.0 is 2010"
        Debug.Print " * "
        Debug.Print " * Your MS Access Build / SP Is " & SysCmd(715)
        Debug.Print " * "
        Debug.Print " * Your MS Access Syscmd Version Is " & SysCmd(acSysCmdRuntime)
        Debug.Print " * "
        Indx = 0    ' Initialize index.
        Debug.Print " * "
        Debug.Print " * *** STARTING ENVIRONMENT VARIABLES *** * "
        Debug.Print " * "
    Do
        Indx = Indx + 1
        
        ' Get environment variable.
        EnvString = Environ(Indx)
        
        ' print value
        Debug.Print " * "
        Debug.Print " * " & Indx & " * " & EnvString
    Loop Until EnvString = ""
        Debug.Print " * "
        Debug.Print " * *** ENDING ENVIRONMENT VARIABLES *** * "
        Debug.Print " * "
      
        ShowEnvironmentVariables = "DONE"
        
    End Function

  3. #3
    Paintballlovr is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2013
    Posts
    96
    Thanks for the assistance.

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

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2013, 01:23 PM
  2. Forcing users to use DB via system.mdw
    By simon955 in forum Programming
    Replies: 1
    Last Post: 01-30-2012, 02:15 PM
  3. Send a message for other user
    By smahdih in forum Access
    Replies: 2
    Last Post: 11-18-2011, 01:52 PM
  4. Replies: 1
    Last Post: 12-02-2010, 03:04 PM

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