Sending Network Messages through Access

Treason

#@$%#!
Local time
Today, 16:59
Joined
Mar 12, 2002
Messages
340
Ummm... I read some threads on this same topic but no one ever wrote the code, or posted it maybe. I am not a good Access developer, but everything I have learned has been through these forums. So anyway, I developed the damn thing to give something back for all the knowledge I sucked from you guys ;)

If any of the good coders are here.. *cough*ghudson*cough* please feel free to alter my sloppy job and improve it, just re-upload it here so I can learn more and everyone can benefit.

you may have to re-link tblMSG in the front-end to get it workin. Open the FE and the BE at the same time, then use the send message form to send a message to the FE. Lemme know what u think
 

Attachments

I'm interested but I Couldn't open either FE or BE

IMO
 
I just realized I made this with my own .mdw file, but I just joined system.mdw and I was still able to open it. Did anyone else have problems opening?? this is Access97 btw...
 
thats cool, I thought I screwed something up. I'm still a rookie.:rolleyes:
 
I like your approach but I am not in favor of having a timer that constantly runs.
It could put a strain on a CPU and consume system resources. I could be
wrong about that but that is my personal opinion.

You could use networking messages if your users all have Windows NT, 2000 or XP.
Play with this code below and see if you like the results. You could easily
incorporate this into a form that allows you to select and choose which
computers you want the message to go to. My example will simply send a
single message to a single computer. You will need to know the users
Computer Name and that is easy to grab using the function at the bottom.
Good Luck!

Code:
Private Sub bNetSend_Click()
    
Dim sUser As String
Dim sMsg As String
    
sUser = "XYZ123User" 'Computer Name
sMsg = "Hello!"
    
Call Shell("C:\WINDOWS\system32\net.exe send " & sUser & " " & sMsg, vbNormalFocus)
    
End Sub

Code:
'Copy this function into a public module
Option Compare Database
Option Explicit
    
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
Public Function ComputerName()
On Error GoTo Err_ComputerName

    Dim Comp_Name_B As String * 255
    Dim Comp_Name As String

    GetComputerName Comp_Name_B, Len(Comp_Name_B)
    Comp_Name = Left(Comp_Name_B, InStr(Comp_Name_B, Chr(0)) - 1)
    If Comp_Name = "" Then Comp_Name = " "
    ComputerName = Comp_Name

    MsgBox "Computer name = " & ComputerName 'testing

Exit_ComputerName:
    Exit Function

Err_ComputerName:
    MsgBox Err.Number, Err.Description
    Resume Exit_ComputerName

End Function
HTH
 

Users who are viewing this thread

Back
Top Bottom