Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

Small Challenge!

瀏覽次數:2 次
跳到第一則未讀訊息

perr...@yahoo.com

未讀,
2007年8月6日 下午5:04:242007/8/6
收件者:
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

未讀,
2007年8月6日 晚上9:19:162007/8/6
收件者:
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.

paii, Ron

未讀,
2007年8月7日 上午8:19:592007/8/7
收件者:

<perr...@yahoo.com> wrote in message
news:1186434264....@g4g2000hsf.googlegroups.com...

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


paii, Ron

未讀,
2007年8月7日 上午8:57:162007/8/7
收件者:

"paii, Ron" <no...@no.com> wrote in message
news:a6udnR2PPvg-_iXb...@athenet.net...

Sorry


Shell("NET SEND " & UserName & " """ & strMessage & """")

Should be
Shell("NET SEND " & Trim$(UserName) & " """ & strMessage & """")


perr...@yahoo.com

未讀,
2007年8月7日 上午10:45:342007/8/7
收件者:
Ron,
I tried the codes, it yields "5 - invalid procedure call or
argument, Function: NumUsers" error message.

P.S.: I am green in programming, in order for me to enable a button to
carry out the codes, I changed your code to a private sub, does that
matter?

Perry

paii, Ron

未讀,
2007年8月7日 上午11:11:322007/8/7
收件者:

<perr...@yahoo.com> wrote in message
news:1186497934.4...@o61g2000hsh.googlegroups.com...

Add these function to the module

Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (ByVal
lpstring As Long) As Long

Private Function TrimNull(startstr As String) As String
TrimNull = Left$(startstr, lstrlen(StrPtr(startstr)))

End Function


perr...@yahoo.com

未讀,
2007年8月7日 上午11:25:272007/8/7
收件者:
Ron,
Thank you so much.

Perry

paii, Ron

未讀,
2007年8月7日 中午12:16:432007/8/7
收件者:

<perr...@yahoo.com> wrote in message
news:1186497934.4...@o61g2000hsh.googlegroups.com...
Forget my last posting, those 2 functions will not help. I inserted the
original function into a new MDB, commented out the SHELL call. It ran
without problem in the imediate window.

?UserListMsg("R:SYSTEM1.LDB","Test")

Step though the code and tell me which line failed.


perr...@yahoo.com

未讀,
2007年8月8日 上午10:09:172007/8/8
收件者:
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

perr...@yahoo.com

未讀,
2007年8月8日 上午10:26:592007/8/8
收件者:
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

Larry Linson

未讀,
2007年8月8日 中午12:08:172007/8/8
收件者:
<perr...@yahoo.com> wrote

> 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


0 則新訊息