By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Small Challenge!

P: n/a
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

Aug 6 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
pe******@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.

Aug 7 '07 #2

P: n/a

<pe******@yahoo.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.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(DBName 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
Aug 7 '07 #3

P: n/a

"paii, Ron" <no**@no.comwrote in message
news:a6******************************@athenet.net. ..
>
<pe******@yahoo.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.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(DBName 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 & """")
Aug 7 '07 #4

P: n/a
Ron,
Thank you so much.

Perry

Aug 7 '07 #5

P: n/a
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

Aug 8 '07 #6

P: n/a
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

Aug 8 '07 #7

P: n/a
<pe******@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
Aug 8 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.