Link to home
Start Free TrialLog in
Avatar of rodneygray
rodneygrayFlag for United States of America

asked on

Send message to specific user from Access Database

I have a database named AutoUpdate. The function is to pull data from a standalone database on a remote pc. If for some reason the routine to pull the data cannot run (network is down), I want the program to alert specific user(s) to the problem. I am trying to use msg.exe to accomplish this task. So far, I have not been able to do so. I have tried using Shell and pstools psexec to accomplish task.
Below is code I have tried so far.
The first code does not run because there is not a password.
The second code asks for a password. When password is entered, a second command prompt opens, code ends, no message.
The third line of code appears to work. However, I get two cmd windows. The first tells me than I am running "Execute Procedures remotely. The second is just blank.
 
    Dim strUser, strMessage As String
    Dim objShell As Object
    Set objShell = CreateObject("WScript.Shell")
   
    strUser = "wilbur.smith"
    strMessage = "Hello"
   'Check to see if the file is available
   If Dir("r:\!a\abc123.txt") <> "" Then
       
    Else
        'File not found
        'objShell.Run ("cmd /k c:\windows\system32\msg.exe * /server:" & strUser & " " & strMessage)
        'objShell.Run ("runas /user:domain\UserName ""C:\Windows\System32\cmd.exe /k C:\windows\system32\msg.exe * /server:" & strUser & " " & strMessage & """")
        'objShell.Run ("cmd /c c:\pstools\psexec -u domain\username -p Password cmd /c msg * /server:" & strUser & " " & strMessage)
    End If
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

I use a 3rd party program called vbMapi to avoid the Outlook security messages.  If you want to continue to use Windows  tools for this, I would suggest you "request attention" and ask the moderator to add the appropriate Windows topic to your topic list.

Dale
How should that work when the network is down? Then the message cannot arrive and the user thinks everything it's fine.

You need to post always a message. So that no message means: Oops. Network issues.
If the network is down then  how can you send a message over the network?
ASKER CERTIFIED SOLUTION
Avatar of rodneygray
rodneygray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
strongly recommend against trying to use Access across a wireless network.  Access is very temperamental  with respect to the connection between the Front End and the Back End and wireless networks do not provide consistent, persistent connections.  You will inevitably have problems with lost connections and database corruption if you persist with this technique.
Avatar of rodneygray

ASKER

Did not receive any other solutions and this one works.