Administrator Message Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All

Is there a way for the data base administrator to send a pop up message to
all users accessing the data base? The pop up message will preferrably be
free format and appear on all users desktops once I Click on a "Send" button.

Can anyone help me??
 
Sam said:
Hello All

Is there a way for the data base administrator to send a pop up
message to all users accessing the data base? The pop up message will
preferrably be free format and appear on all users desktops once I
Click on a "Send" button.

Can anyone help me??

In a hidden form (or a form that is always open) use the Timer event to test for
a value in a single row table. When something is found there open another form
displaying it. When you want to send a message you simply make an entry in that
table.

Now to make it more complicated...

You need a way so that if the message table is tested once every 10 seconds it
will not display the same message if the user has already seen it. You could
add a local table that is used to store the DateTime of the last message viewed
and a similar DateTime field would be added to the message master table (no
longer limited to a single row) so your code can determine whether the message
is a new one that should be displayed or an old one that can be ignored.
 
Sam,

Put the code into a standard module. Then, knowing the name of the computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following text
to a *.txt file called "frmUserMessage_2003.txt". Then open the Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin
0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin
0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin
0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,
0x010400109c00980303f700040100090000000000000001000700580201000100 ,
0x5802020000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x00000000010000000300000000000000000000000000000000000000e2a497bc ,
0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,
0x00000000000000000000000000000050415f3032313300000000000000000000 ,
0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,
0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,
0x01000b0011000600050003000700030003000200000000000000000000000f00 ,
0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,
0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,
0x00010000000000030000f7030000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000010000070000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000100000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000010000000000 ,
0x0000000000000110000000000000000004000000010000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin
0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
ColumnWidths ="1701;1701;1134;567"
OnClick ="[Event Procedure]"
GUID = Begin
0x5dd2be6c4fdd9a4baaecec653ee6a760
End
Begin
Begin Label
OverlapFlags =85
Left =226
Top =226
Width =1755
Height =240
Name ="Label1"
Caption ="Logged on users"
GUID = Begin
0x89542b3aab335c49a38ac90b63207bf3
End
End
End
End
Begin CommandButton
OverlapFlags =85
Left =5896
Top =510
Width =1303
Height =454
TabIndex =2
Name ="cmdSend"
Caption ="Send"
OnClick ="[Event Procedure]"
GUID = Begin
0xc9872c9ee3400d469235c74246169557
End
End
Begin Label
OverlapFlags =93
Left =226
Top =566
Width =916
Height =227
Name ="Label5"
Caption ="Computer"
GUID = Begin
0x6e97b30c1dad19448c01cea1d27187fa
End
End
Begin Label
OverlapFlags =93
Left =1927
Top =566
Width =916
Height =227
Name ="Label6"
Caption ="Login Name"
GUID = Begin
0xd7205623ef405a49b7e634ff5871410e
End
End
Begin Label
OverlapFlags =93
Left =3571
Top =566
Width =916
Height =227
Name ="Label7"
Caption ="Connected"
GUID = Begin
0x3a145ebede855245b7339440f94e3a45
End
End
Begin Label
OverlapFlags =93
Left =4762
Top =566
Width =630
Height =225
Name ="Label8"
Caption ="Suspect"
GUID = Begin
0xaff84689c0445b488fe5b127cbc8de76
End
End
Begin ComboBox
RowSourceTypeInt =1
OldBorderStyle =0
OverlapFlags =85
IMESentenceMode =3
ListWidth =7371
Left =980
Top =2437
Width =4671
Height =285
TabIndex =1
GUID = Begin
0x955b2a363a5fad4f8edb29d05ffa7c83
End
Name ="cboMessage"
RowSourceType ="Value List"
Begin
Begin Label
OverlapFlags =85
Left =226
Top =2438
Width =705
Height =240
Name ="Label3"
Caption ="Message"
GUID = Begin
0x85e46ac52e8a0a47830d9878dfa3a5ae
End
End
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit

Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Private Const msg_MSG1 = "The database will be shutdown for maintenance in 2
minutes." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG2 = "Exclusive access to the database is required for
maintenance." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG3 = "Exclusive access to the database is required for
approximately 2 minutes." & vbCrLf & vbCrLf & "Please log off as soon as
possible."
Private Const msg_MSG4 = "Your user account has exceeded its non-activity
limit for this application." & vbCrLf & vbCrLf & "You will be automatically
logged off in 2 minutes."
Private vUserSelected As Variant

Private Sub cmdSend_Click()
Dim lRetVal As Long

On Error GoTo Proc_Err

If IsNull(vUserSelected) Or IsEmpty(vUserSelected) Then
DoCmd.Beep
MsgBox "You must select a user", vbOKOnly + vbExclamation, "No user
selected"
ElseIf Len(Trim(Me.cboMessage)) > 0 Then
lRetVal = Shell("NET SEND " & CStr(vUserSelected) & " """ &
Me.cboMessage & """", vbHide)
Else
DoCmd.Beep
MsgBox "You must enter some text as a message to send.", vbOKOnly +
vbExclamation, "Invalid message text"
End If

Proc_Exit:
Exit Sub

Proc_Err:
DoCmd.Beep
MsgBox "Error " & Err.Number & vbCrLf & _
Err.Description, vbOKOnly + vbExclamation, _
"Message not sent"

Resume Proc_Exit
End Sub

Private Sub Form_Load()
'Print the details of all currently logged-on users
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sMsg As String
Dim sUsers As String
Dim lRetVal As Long

'============================
'Setup the default messages
'============================
sMsg = msg_MSG1
sMsg = sMsg & ";" & msg_MSG2
sMsg = sMsg & ";" & msg_MSG3
sMsg = sMsg & ";" & msg_MSG4
Me.cboMessage.RowSource = sMsg

'============================
'Populate the list with users
'============================
Set rs = CurrentProject.Connection.OpenSchema( _
adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)

'Loop through the recordset
Do Until rs.EOF
For Each fld In rs.Fields
'Loop through the Fields collection
sUsers = sUsers & IIf(Len(sUsers) > 0, ";", "") & _
Trim(Replace(Nz(fld.Value, "-NULL-"), Chr(0), ""))

'Debug.Print fld.Name
'Debug.Print vbTab & Nz(fld.Value, "-NULL-")
Next fld

rs.MoveNext
Loop

Me.lstUsers.RowSource = sUsers
lRetVal = Me.lstUsers.ListCount

'============================
'Clean up
'============================
rs.Close
Set fld = Nothing
Set rs = Nothing
End Sub

Private Sub lstUsers_Click()
vUserSelected = Me.lstUsers
End Sub


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------
 
Sorry Graham

You have totally lost me here. The text file that you are referring to....
do you mean copy into the notepad and save as frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

Graham R Seach said:
Sam,

Put the code into a standard module. Then, knowing the name of the computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following text
to a *.txt file called "frmUserMessage_2003.txt". Then open the Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin
0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin
0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin
0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,
0x010400109c00980303f700040100090000000000000001000700580201000100 ,
0x5802020000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x00000000010000000300000000000000000000000000000000000000e2a497bc ,
0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,
0x00000000000000000000000000000050415f3032313300000000000000000000 ,
0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,
0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,
0x01000b0011000600050003000700030003000200000000000000000000000f00 ,
0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,
0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,
0x00010000000000030000f7030000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000010000070000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000100000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000010000000000 ,
0x0000000000000110000000000000000004000000010000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin
0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
ColumnWidths ="1701;1701;1134;567"
OnClick ="[Event Procedure]"
GUID = Begin
0x5dd2be6c4fdd9a4baaecec653ee6a760
End
Begin
Begin Label
OverlapFlags =85
Left =226
Top =226
Width =1755
Height =240
Name ="Label1"
Caption ="Logged on users"
GUID = Begin
0x89542b3aab335c49a38ac90b63207bf3
End
End
End
End
Begin CommandButton
OverlapFlags =85
Left =5896
Top =510
Width =1303
Height =454
TabIndex =2
Name ="cmdSend"
Caption ="Send"
OnClick ="[Event Procedure]"
GUID = Begin
0xc9872c9ee3400d469235c74246169557
End
End
Begin Label
OverlapFlags =93
Left =226
Top =566
Width =916
Height =227
Name ="Label5"
Caption ="Computer"
GUID = Begin
0x6e97b30c1dad19448c01cea1d27187fa
End
End
Begin Label
OverlapFlags =93
Left =1927
Top =566
Width =916
Height =227
Name ="Label6"
Caption ="Login Name"
GUID = Begin
0xd7205623ef405a49b7e634ff5871410e
End
End
Begin Label
OverlapFlags =93
Left =3571
Top =566
Width =916
Height =227
Name ="Label7"
Caption ="Connected"
GUID = Begin
0x3a145ebede855245b7339440f94e3a45
End
End
Begin Label
OverlapFlags =93
Left =4762
Top =566
Width =630
Height =225
Name ="Label8"
Caption ="Suspect"
GUID = Begin
0xaff84689c0445b488fe5b127cbc8de76
End
End
Begin ComboBox
RowSourceTypeInt =1
OldBorderStyle =0
OverlapFlags =85
IMESentenceMode =3
ListWidth =7371
Left =980
Top =2437
Width =4671
Height =285
TabIndex =1
GUID = Begin
0x955b2a363a5fad4f8edb29d05ffa7c83
End
Name ="cboMessage"
RowSourceType ="Value List"
Begin
Begin Label
OverlapFlags =85
Left =226
Top =2438
Width =705
Height =240
Name ="Label3"
Caption ="Message"
GUID = Begin
0x85e46ac52e8a0a47830d9878dfa3a5ae
End
End
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit

Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Private Const msg_MSG1 = "The database will be shutdown for maintenance in 2
minutes." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG2 = "Exclusive access to the database is required for
maintenance." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG3 = "Exclusive access to the database is required for
approximately 2 minutes." & vbCrLf & vbCrLf & "Please log off as soon as
possible."
Private Const msg_MSG4 = "Your user account has exceeded its non-activity
limit for this application." & vbCrLf & vbCrLf & "You will be automatically
logged off in 2 minutes."
Private vUserSelected As Variant

Private Sub cmdSend_Click()
Dim lRetVal As Long
 
Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any code
module (or Press Alt +F11). If the Immediate Window (normally docked at the
bottom of the screen) is not open, select [Immediate Window] from the [View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called "frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Sorry Graham

You have totally lost me here. The text file that you are referring to....
do you mean copy into the notepad and save as frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

Graham R Seach said:
Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,

0x010400109c00980303f700040100090000000000000001000700580201000100 ,

0x5802020000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x00000000010000000300000000000000000000000000000000000000e2a497bc ,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,

0x00000000000000000000000000000050415f3032313300000000000000000000 ,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,

0x01000b0011000600050003000700030003000200000000000000000000000f00 ,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,

0x00010000000000030000f7030000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000010000070000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000100000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000010000000000 ,

0x0000000000000110000000000000000004000000010000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin

0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
ColumnWidths ="1701;1701;1134;567"
OnClick ="[Event Procedure]"
GUID = Begin
0x5dd2be6c4fdd9a4baaecec653ee6a760
End
Begin
Begin Label
OverlapFlags =85
Left =226
Top =226
Width =1755
Height =240
Name ="Label1"
Caption ="Logged on users"
GUID = Begin
0x89542b3aab335c49a38ac90b63207bf3
End
End
End
End
Begin CommandButton
OverlapFlags =85
Left =5896
Top =510
Width =1303
Height =454
TabIndex =2
Name ="cmdSend"
Caption ="Send"
OnClick ="[Event Procedure]"
GUID = Begin
0xc9872c9ee3400d469235c74246169557
End
End
Begin Label
OverlapFlags =93
Left =226
Top =566
Width =916
Height =227
Name ="Label5"
Caption ="Computer"
GUID = Begin
0x6e97b30c1dad19448c01cea1d27187fa
End
End
Begin Label
OverlapFlags =93
Left =1927
Top =566
Width =916
Height =227
Name ="Label6"
Caption ="Login Name"
GUID = Begin
0xd7205623ef405a49b7e634ff5871410e
End
End
Begin Label
OverlapFlags =93
Left =3571
Top =566
Width =916
Height =227
Name ="Label7"
Caption ="Connected"
GUID = Begin
0x3a145ebede855245b7339440f94e3a45
End
End
Begin Label
OverlapFlags =93
Left =4762
Top =566
Width =630
Height =225
Name ="Label8"
Caption ="Suspect"
GUID = Begin
0xaff84689c0445b488fe5b127cbc8de76
End
End
Begin ComboBox
RowSourceTypeInt =1
OldBorderStyle =0
OverlapFlags =85
IMESentenceMode =3
ListWidth =7371
Left =980
Top =2437
Width =4671
Height =285
TabIndex =1
GUID = Begin
0x955b2a363a5fad4f8edb29d05ffa7c83
End
Name ="cboMessage"
RowSourceType ="Value List"
Begin
Begin Label
OverlapFlags =85
Left =226
Top =2438
Width =705
Height =240
Name ="Label3"
Caption ="Message"
GUID = Begin
0x85e46ac52e8a0a47830d9878dfa3a5ae
End
End
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit

Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Private Const msg_MSG1 = "The database will be shutdown for maintenance
in 2
minutes." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG2 = "Exclusive access to the database is required
for
maintenance." & vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG3 = "Exclusive access to the database is required
for
approximately 2 minutes." & vbCrLf & vbCrLf & "Please log off as soon as
possible."
Private Const msg_MSG4 = "Your user account has exceeded its non-activity
limit for this application." & vbCrLf & vbCrLf & "You will be
automatically
logged off in 2 minutes."
Private vUserSelected As Variant

Private Sub cmdSend_Click()
Dim lRetVal As Long
 
Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what you
suggested. I Saved this file in the C:\ drive without any folders to keep
things simple. I then copied that small snippet as you described. When I
altered the location and then pressed enter I received the following message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

Graham R Seach said:
Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any code
module (or Press Alt +F11). If the Immediate Window (normally docked at the
bottom of the screen) is not open, select [Immediate Window] from the [View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called "frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Sorry Graham

You have totally lost me here. The text file that you are referring to....
do you mean copy into the notepad and save as frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

Graham R Seach said:
Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,

0x010400109c00980303f700040100090000000000000001000700580201000100 ,

0x5802020000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x00000000010000000300000000000000000000000000000000000000e2a497bc ,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,

0x00000000000000000000000000000050415f3032313300000000000000000000 ,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,

0x01000b0011000600050003000700030003000200000000000000000000000f00 ,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,

0x00010000000000030000f7030000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000010000070000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000100000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000010000000000 ,

0x0000000000000110000000000000000004000000010000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin

0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
ColumnWidths ="1701;1701;1134;567"
OnClick ="[Event Procedure]"
GUID = Begin
0x5dd2be6c4fdd9a4baaecec653ee6a760
End
Begin
Begin Label
OverlapFlags =85
Left =226
Top =226
Width =1755
Height =240
Name ="Label1"
Caption ="Logged on users"
GUID = Begin
0x89542b3aab335c49a38ac90b63207bf3
End
End
End
End
Begin CommandButton
OverlapFlags =85
Left =5896
Top =510
Width =1303
Height =454
TabIndex =2
Name ="cmdSend"
Caption ="Send"
OnClick ="[Event Procedure]"
GUID = Begin
0xc9872c9ee3400d469235c74246169557
End
End
Begin Label
OverlapFlags =93
Left =226
Top =566
Width =916
Height =227
Name ="Label5"
Caption ="Computer"
GUID = Begin
0x6e97b30c1dad19448c01cea1d27187fa
End
End
Begin Label
OverlapFlags =93
Left =1927
Top =566
Width =916
Height =227
Name ="Label6"
Caption ="Login Name"
GUID = Begin
 
Sam,

OK, it's just for the wrong version; that's all.

If you open the text file for editing (again using Notepad); the first two
lines are as follows:
Version =20
VersionRequired =20

This version is for Access 2002/2003.

Change it as follows for Access 2000:
Version =19
VersionRequired =19

....and like so for Access 97:
Version =17
VersionRequired =17

Save the file, then try again.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what you
suggested. I Saved this file in the C:\ drive without any folders to keep
things simple. I then copied that small snippet as you described. When I
altered the location and then pressed enter I received the following
message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

Graham R Seach said:
Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any code
module (or Press Alt +F11). If the Immediate Window (normally docked at
the
bottom of the screen) is not open, select [Immediate Window] from the
[View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on
one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called "frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Sorry Graham

You have totally lost me here. The text file that you are referring
to....
do you mean copy into the notepad and save as
frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

:

Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the
Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,

0x010400109c00980303f700040100090000000000000001000700580201000100 ,

0x5802020000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x00000000010000000300000000000000000000000000000000000000e2a497bc ,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,

0x00000000000000000000000000000050415f3032313300000000000000000000 ,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,

0x01000b0011000600050003000700030003000200000000000000000000000f00 ,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,

0x00010000000000030000f7030000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000010000070000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000100000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000010000000000 ,

0x0000000000000110000000000000000004000000010000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin

0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
ColumnWidths ="1701;1701;1134;567"
OnClick ="[Event Procedure]"
GUID = Begin
0x5dd2be6c4fdd9a4baaecec653ee6a760
End
Begin
Begin Label
OverlapFlags =85
Left =226
Top =226
Width =1755
Height =240
Name ="Label1"
Caption ="Logged on users"
GUID = Begin
0x89542b3aab335c49a38ac90b63207bf3
End
End
End
End
Begin CommandButton
OverlapFlags =85
Left =5896
Top =510
Width =1303
Height =454
TabIndex =2
Name ="cmdSend"
Caption ="Send"
OnClick ="[Event Procedure]"
GUID = Begin
0xc9872c9ee3400d469235c74246169557
End
End
Begin Label
OverlapFlags =93
Left =226
Top =566
Width =916
Height =227
Name ="Label5"
Caption ="Computer"
GUID = Begin
0x6e97b30c1dad19448c01cea1d27187fa
End
End
Begin Label
OverlapFlags =93
Left =1927
Top =566
Width =916
Height =227
Name ="Label6"
Caption ="Login Name"
GUID = Begin
 
Graham.. Thanks for your assistance

I am still getting the same message, however let me expand...the error
message is...Run-time error "2285". Does this help?

Also I am running MS Access XP. Does that make a difference with the set up
coes in the TXT file? I did notice that the beginning of the code
(LoadFromText acForm, "frmUserMessage", "path to frmUserMessage_2003.txt")
Should this show (LoadFromText acForm_2003, "frmUserMessage", "path to
frmUserMessage_2003.txt")????



Graham R Seach said:
Sam,

OK, it's just for the wrong version; that's all.

If you open the text file for editing (again using Notepad); the first two
lines are as follows:
Version =20
VersionRequired =20

This version is for Access 2002/2003.

Change it as follows for Access 2000:
Version =19
VersionRequired =19

....and like so for Access 97:
Version =17
VersionRequired =17

Save the file, then try again.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what you
suggested. I Saved this file in the C:\ drive without any folders to keep
things simple. I then copied that small snippet as you described. When I
altered the location and then pressed enter I received the following
message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

Graham R Seach said:
Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any code
module (or Press Alt +F11). If the Immediate Window (normally docked at
the
bottom of the screen) is not open, select [Immediate Window] from the
[View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on
one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called "frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sorry Graham

You have totally lost me here. The text file that you are referring
to....
do you mean copy into the notepad and save as
frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

:

Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the
Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000 ,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000 ,

0x010400109c00980303f700040100090000000000000001000700580201000100 ,

0x5802020000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x00000000010000000300000000000000000000000000000000000000e2a497bc ,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000 ,

0x00000000000000000000000000000050415f3032313300000000000000000000 ,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230 ,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00 ,

0x01000b0011000600050003000700030003000200000000000000000000000f00 ,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000 ,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000 ,

0x00010000000000030000f7030000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000010000070000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000100000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000010000000000 ,

0x0000000000000110000000000000000004000000010000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,

0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin

0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c ,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
 
Sam,

For Access XP, you should be using the one with:
Version =20
VersionRequired =20

....and this is how the Immediate Window command line should look:
LoadFromText acForm, "frmUserMessage", "c:\frmUserMessage_2003.txt"

I'm very surprised that you get an error 2285 (Argument Not Optional).
Create a new database in XP and try again in that database. If it works,
then just copy the form to your database. If not, then I'll give you
instructions on how to create the form manually.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham.. Thanks for your assistance

I am still getting the same message, however let me expand...the error
message is...Run-time error "2285". Does this help?

Also I am running MS Access XP. Does that make a difference with the set
up
coes in the TXT file? I did notice that the beginning of the code
(LoadFromText acForm, "frmUserMessage", "path to frmUserMessage_2003.txt")
Should this show (LoadFromText acForm_2003, "frmUserMessage", "path to
frmUserMessage_2003.txt")????



Graham R Seach said:
Sam,

OK, it's just for the wrong version; that's all.

If you open the text file for editing (again using Notepad); the first
two
lines are as follows:
Version =20
VersionRequired =20

This version is for Access 2002/2003.

Change it as follows for Access 2000:
Version =19
VersionRequired =19

....and like so for Access 97:
Version =17
VersionRequired =17

Save the file, then try again.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what you
suggested. I Saved this file in the C:\ drive without any folders to
keep
things simple. I then copied that small snippet as you described. When
I
altered the location and then pressed enter I received the following
message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

:

Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have
been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any
code
module (or Press Alt +F11). If the Immediate Window (normally docked
at
the
bottom of the screen) is not open, select [Immediate Window] from the
[View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on
one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called
"frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sorry Graham

You have totally lost me here. The text file that you are referring
to....
do you mean copy into the notepad and save as
frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

:

Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the
following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the
following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the
Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000
,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000
,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000
,

0x010400109c00980303f700040100090000000000000001000700580201000100
,

0x5802020000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x00000000010000000300000000000000000000000000000000000000e2a497bc
,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000
,

0x00000000000000000000000000000050415f3032313300000000000000000000
,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230
,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00
,

0x01000b0011000600050003000700030003000200000000000000000000000f00
,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000
,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000
,

0x00010000000000030000f7030000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000010000070000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000100000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000010000000000
,

0x0000000000000110000000000000000004000000010000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,
0x0000000000000000ef73000000000000e2a497bc
End
PrtDevNames = Begin

0x08001500280001004c65786d61726b2057383230005c5c53414e41545030325c
,
0x50415f303231330031302e3134302e33302e31393a50524e00
End
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
Width =1701
Height =283
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin TextBox
FELineBreak = NotDefault
SpecialEffect =2
OldBorderStyle =0
Width =1701
LabelX =-1701
FontName ="Tahoma"
AsianLineBreak =255
End
Begin ListBox
SpecialEffect =2
Width =1701
Height =1417
LabelX =-1701
FontName ="Tahoma"
End
Begin ComboBox
SpecialEffect =2
Width =1701
LabelX =-1701
FontName ="Tahoma"
End
Begin Section
Height =3127
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0x467e517cc211fb4f80d0346c64fdb141
End
Begin
Begin ListBox
RowSourceTypeInt =1
OverlapFlags =87
IMESentenceMode =3
ColumnCount =4
Left =226
Top =794
Width =5451
Height =1477
Name ="lstUsers"
RowSourceType ="Value List"
 
Graham

Tried what you suggested and still gave me the same message.

Can you please provide instructions on how to set up form manually????

Thanks

Graham R Seach said:
Sam,

For Access XP, you should be using the one with:
Version =20
VersionRequired =20

....and this is how the Immediate Window command line should look:
LoadFromText acForm, "frmUserMessage", "c:\frmUserMessage_2003.txt"

I'm very surprised that you get an error 2285 (Argument Not Optional).
Create a new database in XP and try again in that database. If it works,
then just copy the form to your database. If not, then I'll give you
instructions on how to create the form manually.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham.. Thanks for your assistance

I am still getting the same message, however let me expand...the error
message is...Run-time error "2285". Does this help?

Also I am running MS Access XP. Does that make a difference with the set
up
coes in the TXT file? I did notice that the beginning of the code
(LoadFromText acForm, "frmUserMessage", "path to frmUserMessage_2003.txt")
Should this show (LoadFromText acForm_2003, "frmUserMessage", "path to
frmUserMessage_2003.txt")????



Graham R Seach said:
Sam,

OK, it's just for the wrong version; that's all.

If you open the text file for editing (again using Notepad); the first
two
lines are as follows:
Version =20
VersionRequired =20

This version is for Access 2002/2003.

Change it as follows for Access 2000:
Version =19
VersionRequired =19

....and like so for Access 97:
Version =17
VersionRequired =17

Save the file, then try again.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what you
suggested. I Saved this file in the C:\ drive without any folders to
keep
things simple. I then copied that small snippet as you described. When
I
altered the location and then pressed enter I received the following
message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

:

Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of stuff.>>
Not at all. I took a punt on your level of expertise; I should have
been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any
code
module (or Press Alt +F11). If the Immediate Window (normally docked
at
the
bottom of the screen) is not open, select [Immediate Window] from the
[View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be on
one
line.) Make sure to enter the correct path to frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called
"frmUserMessage".
Open frmUserMessage, and the rest I think is fairly self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sorry Graham

You have totally lost me here. The text file that you are referring
to....
do you mean copy into the notepad and save as
frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of stuff.

Regards

:

Sam,

Put the code into a standard module. Then, knowing the name of the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the
following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the
following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the
Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000
,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000
,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000
,

0x010400109c00980303f700040100090000000000000001000700580201000100
,

0x5802020000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x00000000010000000300000000000000000000000000000000000000e2a497bc
,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000
,

0x00000000000000000000000000000050415f3032313300000000000000000000
,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230
,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00
,

0x01000b0011000600050003000700030003000200000000000000000000000f00
,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000
,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000
,

0x00010000000000030000f7030000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000010000070000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000100000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,
 
Sam,

I had another MVP try the code, without problem, so it must be something on
your end. Not to worry. Here are the instructions for creating the form
manually.

1. Create a form with three controls; a listbox called "lstUsers", a combo
called "cboMessage", a command button called "cmdSend", and five labels
("lblTitle", "lblComputer", "lblLoginName", "lblConnected", and
"lblSuspect").

2. Set the following form properties:
Width: 13.097cm
Detail Section Height: 5.515cm
Caption: "User Message"
DefaultView: Single Form
ScrollBars: Neither
RecordSelectors: No
NavigationButtons: No
DividingLines: No
AutoResize: Yes
AutoCenter: Yes
BorderStyle: Dialog
ControlBox: Yes
MinMaxButtons: None
CloseButton: Yes

3. Set the following properties for lstUsers:
Width: 9.614cm
Height: 2.605cm
Left: 0.399cm
Top: 1.4cm
ColumnCount: 4
ColumnWidths: 3cm;3cm;2cm;1cm
RowSourceType: Value List

4. Set the following properties for cboMessage:
Left: 1.728cm
Top: 4.298cm
Width: 8.238cm
Height: 0.503cm
ColumnCount: 1
ListWidth: 13cm
Caption: "Message"

5. Set the following properties for cmdSend:
Left: 10.399cm
Top: 0.899cm
Width: 2.298cm
Height: 0.801cm
Caption: "Send"

6. Set the following properties for lblTitle:
Left: 0.399cm
Top: 0.399cm
Width: 3.095cm
Height: 0.423cm
Caption: "Logged on users"

7. Set the following properties for lblComputer:
Left: 0.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Computer"

8. Set the following properties for lblLoginName:
Left: 3.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Login Name"

9. Set the following properties for lblConnected:
Left: 6.298cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Connected"

10. Set the following properties for lblSuspect:
Left: 8.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Suspect"

11. Add the following to the form's Declarations section (under Option
Explicit):
Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Private Const msg_MSG1 = "The database will be shutdown for maintenance
in 2 minutes." & _
vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG2 = "Exclusive access to the database is required
for maintenance." & _
vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG3 = "Exclusive access to the database is required
for approximately 2 minutes." & _
vbCrLf & vbCrLf & "Please log off as soon as possible."
Private Const msg_MSG4 = "Your user account has exceeded its
non-activity limit for this application." & _
vbCrLf & vbCrLf & "You will be automatically logged off in 2
minutes."

Private vUserSelected As Variant

12. Add the following to the form's Load event:
Private Sub Form_Load()
'Print the details of all currently logged-on users
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sMsg As String
Dim sUsers As String
Dim lRetVal As Long

'============================
'Setup the default messages
'============================
sMsg = msg_MSG1
sMsg = sMsg & ";" & msg_MSG2
sMsg = sMsg & ";" & msg_MSG3
sMsg = sMsg & ";" & msg_MSG4
Me.cboMessage.RowSource = sMsg

'============================
'Populate the list with users
'============================
Set rs = CurrentProject.Connection.OpenSchema( _
adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)

'Loop through the recordset
Do Until rs.EOF
For Each fld In rs.Fields
'Loop through the Fields collection
sUsers = sUsers & IIf(Len(sUsers) > 0, ";", "") & _
Trim(Replace(Nz(fld.Value, "-NULL-"), Chr(0), ""))

'Debug.Print fld.Name
'Debug.Print vbTab & Nz(fld.Value, "-NULL-")
Next fld

rs.MoveNext
Loop

Me.lstUsers.RowSource = sUsers
lRetVal = Me.lstUsers.ListCount

'============================
'Clean up
'============================
rs.Close
Set fld = Nothing
Set rs = Nothing
End Sub

13. Add the following to lstUsers' Click event:
Private Sub lstUsers_Click()
vUserSelected = Me.lstUsers
End Sub

14. Add the following to cmdSend's Click event:
Private Sub cmdSend_Click()
Dim lRetVal As Long

On Error GoTo Proc_Err

If IsNull(vUserSelected) Or IsEmpty(vUserSelected) Then
DoCmd.Beep
MsgBox "You must select a user", vbOKOnly + vbExclamation, "No
user selected"
ElseIf Len(Trim(Me.cboMessage)) > 0 Then
lRetVal = Shell("NET SEND " & CStr(vUserSelected) & " """ &
Me.cboMessage & """", vbHide)
Else
DoCmd.Beep
MsgBox "You must enter some text as a message to send.",
vbOKOnly + vbExclamation, "Invalid message text"
End If

Proc_Exit:
Exit Sub

Proc_Err:
DoCmd.Beep
MsgBox "Error " & Err.Number & vbCrLf & _
Err.Description, vbOKOnly + vbExclamation, _
"Message not sent"

Resume Proc_Exit
End Sub

15. Save the form.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham

Tried what you suggested and still gave me the same message.

Can you please provide instructions on how to set up form manually????

Thanks

Graham R Seach said:
Sam,

For Access XP, you should be using the one with:
Version =20
VersionRequired =20

....and this is how the Immediate Window command line should look:
LoadFromText acForm, "frmUserMessage", "c:\frmUserMessage_2003.txt"

I'm very surprised that you get an error 2285 (Argument Not Optional).
Create a new database in XP and try again in that database. If it works,
then just copy the form to your database. If not, then I'll give you
instructions on how to create the form manually.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sam said:
Graham.. Thanks for your assistance

I am still getting the same message, however let me expand...the error
message is...Run-time error "2285". Does this help?

Also I am running MS Access XP. Does that make a difference with the
set
up
coes in the TXT file? I did notice that the beginning of the code
(LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt")
Should this show (LoadFromText acForm_2003, "frmUserMessage", "path to
frmUserMessage_2003.txt")????



:

Sam,

OK, it's just for the wrong version; that's all.

If you open the text file for editing (again using Notepad); the first
two
lines are as follows:
Version =20
VersionRequired =20

This version is for Access 2002/2003.

Change it as follows for Access 2000:
Version =19
VersionRequired =19

....and like so for Access 97:
Version =17
VersionRequired =17

Save the file, then try again.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Graham

Thanks for your patience.

I have copied the really long code into note pad and called it what
you
suggested. I Saved this file in the C:\ drive without any folders to
keep
things simple. I then copied that small snippet as you described.
When
I
altered the location and then pressed enter I received the following
message:-

"Cant create the output file"

What have I done wrong????

Thanks again for all of your help

:

Sam,

<<Sorry, I am a bit of a dummy when it comes to this sort of
stuff.>>
Not at all. I took a punt on your level of expertise; I should have
been
more explicit. :-)

Yes, I did mean to copy the code to NotePad, and save the file as
"frmUserMessage_2003.txt". Then launch your database, and open any
code
module (or Press Alt +F11). If the Immediate Window (normally
docked
at
the
bottom of the screen) is not open, select [Immediate Window] from
the
[View]
menu.

Enter the following into the Immediate Window:
LoadFromText acForm, "frmUserMessage", "path to
frmUserMessage_2003.txt"

(The newsreader will break the above into 2 lines. It should all be
on
one
line.) Make sure to enter the correct path to
frmUserMessage_2003.txt,
enclosed in double-quotes.

Then press [Enter]. This will create a new form called
"frmUserMessage".
Open frmUserMessage, and the rest I think is fairly
self-explanatory.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Sorry Graham

You have totally lost me here. The text file that you are
referring
to....
do you mean copy into the notepad and save as
frmUserMessage_2003.txt?????

I do not understand the next part....

Then open the Immediate
window in theAccess IDE, and enter the following command:

Can you expand on this???
Sorry, I am a bit of a dummy when it comes to this sort of
stuff.

Regards

:

Sam,

Put the code into a standard module. Then, knowing the name of
the
computer
you want to send the message to, call it like so:
UsrMsg strMessage, strComputerName

If you don't know the name of the computer, you can use the
following
form,
which does the same thing (in Access 2002/2003).

DO NOT JUST PASTE THIS CODE INTO A MODULE OR FORM. Save the
following
text
to a *.txt file called "frmUserMessage_2003.txt". Then open the
Immediate
window in theAccess IDE, and enter the following command:

LoadFromText acForm, "frmUserMessage",
"c:\Temp\frmUserMessage_2003.txt"

Naturally, change the path to the file as appropriate.

Version =20
VersionRequired =20
Checksum =-1320280745
Begin Form
PopUp = NotDefault
Modal = NotDefault
RecordSelectors = NotDefault
MaxButton = NotDefault
MinButton = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
DividingLines = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
ViewsAllowed =1
TabularFamily =0
BorderStyle =3
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridY =10
Width =7426
DatasheetFontHeight =10
ItemSuffix =9
Left =3915
Top =2490
Right =11340
Bottom =5595
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xb790d0050cc6e240
End
GUID = Begin
0x3a3e08aee6a5324dae74b1b356d1f5e8
End
NameMap = Begin

0x0acc0e5500000000000000000000000000000000000000000c00000002000000
,
0x0000000000000000000000000000
End
Caption ="User Message"
DatasheetFontName ="Arial"
PrtMip = Begin

0xab050000a5050000a5050000a505000000000000201c0000e010000001000000
,
0x010000006801000000000000a10700000100000001000000
End
PrtDevMode = Begin

0x5c5c53414e41545030325c50415f303231330000000000000000000000000000
,

0x010400109c00980303f700040100090000000000000001000700580201000100
,

0x5802020000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x00000000010000000300000000000000000000000000000000000000e2a497bc
,

0x00010102ff020200010000000000004c65786d61726b20573832300000000000
,

0x00000000000000000000000000000050415f3032313300000000000000000000
,

0x000000000000000000000000000000002b0200004c65786d61726b2057383230
,

0x002052000000070031000000086e9102006e910220008001ff7fff7f00002d00
,

0x01000b0011000600050003000700030003000200000000000000000000000f00
,

0x030007000000e9010300bfe60300e7620100010016000e0012001f0011000000
,

0x41003e01e2a497bc02000100ff00400058022c01000000000000580200000000
,

0x00010000000000030000f7030000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000010000070000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000a0000000a0000000a0000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000100000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,

0x0000000000000000000000000000000000000000000000000000000000000000
,
 
Hello Graham

Set all up appart from the following:-

i do not know where this is..."Add the following to the form's Declarations
section (under Option Explicit):"

Sorry.. Like I said I am a novice when it comes to this stuff

Regards

Sam
 
Sam,

If you look in your form's code module, you should see:
Option Compare Database
Option Explicit

This area is called the Declarations Section.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------
 
Sam,

Option Explicit is irrelevent *in this case*, because you can place the
declarations under Option Compare Database.

Where Option Explicit does become important is when you start writing code.
Option Explicit tells Access to check that all variables have been declared
before they can be used, thereby ensuring that simple spelling mistakes
don't automatically result in the creation of a (mistakenly) new variable.

Since you don't have Option Explicit declared, you should manually type it
in (under Option Compare Database) in *every* standard module, and in the
code module for *every* form and report. But that's not enough; you need to
set the Option Explicit option, so the next time you create a
form/report/module, Option Explicit will be declared automatically. To do
that:

1. Open any code module.
2. Select [Options] from the [Tools] menu.
3. Select the [Editor] tab.
4. Tick the [Require Variable Declaration] checkbox.
5. Click OK.

So from your earlier post, can I infer that you've got it working now?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Graham

I have managed to get the form to pop up and it appears to be formatted ok.
I just need to put the code in so that it populates who is logged on.

I apologise for all of the hassles. I suppose what I do need to know is who
is actually logged on to the data base. If I can at least do that then I can
either call them to get off the data base rather than send a message via this
form.

Graham R Seach said:
Sam,

Option Explicit is irrelevent *in this case*, because you can place the
declarations under Option Compare Database.

Where Option Explicit does become important is when you start writing code.
Option Explicit tells Access to check that all variables have been declared
before they can be used, thereby ensuring that simple spelling mistakes
don't automatically result in the creation of a (mistakenly) new variable.

Since you don't have Option Explicit declared, you should manually type it
in (under Option Compare Database) in *every* standard module, and in the
code module for *every* form and report. But that's not enough; you need to
set the Option Explicit option, so the next time you create a
form/report/module, Option Explicit will be declared automatically. To do
that:

1. Open any code module.
2. Select [Options] from the [Tools] menu.
3. Select the [Editor] tab.
4. Tick the [Require Variable Declaration] checkbox.
5. Click OK.

So from your earlier post, can I infer that you've got it working now?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Sam said:
Graham

Sorry.... How do I find the Option Explicit if it is not in the module???
Do
I Type in "Option Explicit"??
 
Sam,

The listbox will list everyone who's currently logged on.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Sam said:
Graham

I have managed to get the form to pop up and it appears to be formatted
ok.
I just need to put the code in so that it populates who is logged on.

I apologise for all of the hassles. I suppose what I do need to know is
who
is actually logged on to the data base. If I can at least do that then I
can
either call them to get off the data base rather than send a message via
this
form.

Graham R Seach said:
Sam,

Option Explicit is irrelevent *in this case*, because you can place the
declarations under Option Compare Database.

Where Option Explicit does become important is when you start writing
code.
Option Explicit tells Access to check that all variables have been
declared
before they can be used, thereby ensuring that simple spelling mistakes
don't automatically result in the creation of a (mistakenly) new
variable.

Since you don't have Option Explicit declared, you should manually type
it
in (under Option Compare Database) in *every* standard module, and in the
code module for *every* form and report. But that's not enough; you need
to
set the Option Explicit option, so the next time you create a
form/report/module, Option Explicit will be declared automatically. To do
that:

1. Open any code module.
2. Select [Options] from the [Tools] menu.
3. Select the [Editor] tab.
4. Tick the [Require Variable Declaration] checkbox.
5. Click OK.

So from your earlier post, can I infer that you've got it working now?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Sam said:
Graham

Sorry.... How do I find the Option Explicit if it is not in the
module???
Do
I Type in "Option Explicit"??

:

Sam,

If you look in your form's code module, you should see:
Option Compare Database
Option Explicit

This area is called the Declarations Section.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Hello Graham

Set all up appart from the following:-

i do not know where this is..."Add the following to the form's
Declarations
section (under Option Explicit):"

Sorry.. Like I said I am a novice when it comes to this stuff

Regards

Sam

:

Sam,

I had another MVP try the code, without problem, so it must be
something
on
your end. Not to worry. Here are the instructions for creating the
form
manually.

1. Create a form with three controls; a listbox called "lstUsers",
a
combo
called "cboMessage", a command button called "cmdSend", and five
labels
("lblTitle", "lblComputer", "lblLoginName", "lblConnected", and
"lblSuspect").

2. Set the following form properties:
Width: 13.097cm
Detail Section Height: 5.515cm
Caption: "User Message"
DefaultView: Single Form
ScrollBars: Neither
RecordSelectors: No
NavigationButtons: No
DividingLines: No
AutoResize: Yes
AutoCenter: Yes
BorderStyle: Dialog
ControlBox: Yes
MinMaxButtons: None
CloseButton: Yes

3. Set the following properties for lstUsers:
Width: 9.614cm
Height: 2.605cm
Left: 0.399cm
Top: 1.4cm
ColumnCount: 4
ColumnWidths: 3cm;3cm;2cm;1cm
RowSourceType: Value List

4. Set the following properties for cboMessage:
Left: 1.728cm
Top: 4.298cm
Width: 8.238cm
Height: 0.503cm
ColumnCount: 1
ListWidth: 13cm
Caption: "Message"

5. Set the following properties for cmdSend:
Left: 10.399cm
Top: 0.899cm
Width: 2.298cm
Height: 0.801cm
Caption: "Send"

6. Set the following properties for lblTitle:
Left: 0.399cm
Top: 0.399cm
Width: 3.095cm
Height: 0.423cm
Caption: "Logged on users"

7. Set the following properties for lblComputer:
Left: 0.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Computer"

8. Set the following properties for lblLoginName:
Left: 3.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Login Name"

9. Set the following properties for lblConnected:
Left: 6.298cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Connected"

10. Set the following properties for lblSuspect:
Left: 8.399cm
Top: 0.998cm
Width: 1.616cm
Height: 0.4cm
Caption: "Suspect"

11. Add the following to the form's Declarations section (under
Option
Explicit):
Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Private Const msg_MSG1 = "The database will be shutdown for
maintenance
in 2 minutes." & _
vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG2 = "Exclusive access to the database is
required
for maintenance." & _
vbCrLf & vbCrLf & "Please log off now."
Private Const msg_MSG3 = "Exclusive access to the database is
required
for approximately 2 minutes." & _
vbCrLf & vbCrLf & "Please log off as soon as possible."
Private Const msg_MSG4 = "Your user account has exceeded its
non-activity limit for this application." & _
vbCrLf & vbCrLf & "You will be automatically logged off
in
2
minutes."

Private vUserSelected As Variant

12. Add the following to the form's Load event:
Private Sub Form_Load()
'Print the details of all currently logged-on users
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sMsg As String
Dim sUsers As String
Dim lRetVal As Long

'============================
'Setup the default messages
'============================
sMsg = msg_MSG1
sMsg = sMsg & ";" & msg_MSG2
sMsg = sMsg & ";" & msg_MSG3
sMsg = sMsg & ";" & msg_MSG4
Me.cboMessage.RowSource = sMsg

'============================
'Populate the list with users
'============================
Set rs = CurrentProject.Connection.OpenSchema( _
adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)

'Loop through the recordset
Do Until rs.EOF
For Each fld In rs.Fields
'Loop through the Fields collection
sUsers = sUsers & IIf(Len(sUsers) > 0, ";", "") & _
Trim(Replace(Nz(fld.Value, "-NULL-"),
Chr(0),
""))

'Debug.Print fld.Name
'Debug.Print vbTab & Nz(fld.Value, "-NULL-")
Next fld

rs.MoveNext
Loop

Me.lstUsers.RowSource = sUsers
lRetVal = Me.lstUsers.ListCount

'============================
'Clean up
'============================
rs.Close
Set fld = Nothing
Set rs = Nothing
End Sub

13. Add the following to lstUsers' Click event:
Private Sub lstUsers_Click()
vUserSelected = Me.lstUsers
End Sub

14. Add the following to cmdSend's Click event:
Private Sub cmdSend_Click()
Dim lRetVal As Long

On Error GoTo Proc_Err

If IsNull(vUserSelected) Or IsEmpty(vUserSelected) Then
DoCmd.Beep
MsgBox "You must select a user", vbOKOnly +
vbExclamation,
"No
user selected"
ElseIf Len(Trim(Me.cboMessage)) > 0 Then
lRetVal = Shell("NET SEND " & CStr(vUserSelected) & "
"""
&
Me.cboMessage & """", vbHide)
Else
DoCmd.Beep
MsgBox "You must enter some text as a message to
send.",
vbOKOnly + vbExclamation, "Invalid message text"
End If

Proc_Exit:
Exit Sub

Proc_Err:
DoCmd.Beep
MsgBox "Error " & Err.Number & vbCrLf & _
Err.Description, vbOKOnly + vbExclamation, _
"Message not sent"

Resume Proc_Exit
End Sub

15. Save the form.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------

Graham

Tried what you suggested and still gave me the same message.

Can you please provide instructions on how to set up form
manually????

Thanks

:
 
Back
Top