A
Andi
Thanks to some earlier posts, I'm trying some new code. I'll be taking
out some of the message boxes (they probably seem silly to you), but I
wanted to see how things were working as it stepped through the code.
The code in the item_close event seems backwards to me, but I still
need to test it out with another user to see what happens when we both
have the record open. What I'm asking for is that if any gurus could
review the code below and tell me if there is anything else I should do
to make this code complete, or if there is something that needs to be
fixed, etc.
Any feedback from the pros is greatly appreciated.
Thanks so much!
Andrea
'module level declaration:
Dim blnReadOnly
Function Item_Open()
If Item.UserProperties("ReadOnly") Then
blnReadOnly = True
msgbox "This item IS ALREADY OPEN by another user. Your changes WILL
NOT be saved"
Else
blnReadOnly = False
item.userproperties.find("ItemOpenUser").value =
application.getnamespace("MAPI").currentuser
msgbox ("Congratulations " & item.userproperties("ItemOpenUser") & "!
This item is NOT currently open by another user. Your changes WILL be
saved")
End If
End Function
'check in Item_Write and if True then Item_Write = False
'in Item_Close if Item.UserProperties("ReadOnly") then set it False and
set blnReadOnly False and save.
Function Item_Write()
if blnReadOnly=true then
item_write=false
msgbox ("Remember " & application.getnamespace("MAPI").currentuser &
" This item IS ALREADY OPEN by the user - " &
item.userproperties("ItemOpenUser") & ". Your changes WILL NOT be
saved")
else
item_write=true
msgbox ("Hooray " & application.getnamespace("MAPI").currentuser & "!
This item is NOT currently open by another user. Your changes WILL be
saved")
end if
End Function
Function Item_Close()
If Item.UserProperties("ReadOnly") Then
msgbox ("Did your changes get saved " &
application.getnamespace("MAPI").currentuser & " ? I think not!")
blnReadOnly = false
item.save
else
msgbox ("As you save and close this item " &
application.getnamespace("MAPI").currentuser & ", you'll be happy to
know that your changes WILL be saved")
blnReadOnly=true
End If
End Function
out some of the message boxes (they probably seem silly to you), but I
wanted to see how things were working as it stepped through the code.
The code in the item_close event seems backwards to me, but I still
need to test it out with another user to see what happens when we both
have the record open. What I'm asking for is that if any gurus could
review the code below and tell me if there is anything else I should do
to make this code complete, or if there is something that needs to be
fixed, etc.
Any feedback from the pros is greatly appreciated.
Thanks so much!
Andrea
'module level declaration:
Dim blnReadOnly
Function Item_Open()
If Item.UserProperties("ReadOnly") Then
blnReadOnly = True
msgbox "This item IS ALREADY OPEN by another user. Your changes WILL
NOT be saved"
Else
blnReadOnly = False
item.userproperties.find("ItemOpenUser").value =
application.getnamespace("MAPI").currentuser
msgbox ("Congratulations " & item.userproperties("ItemOpenUser") & "!
This item is NOT currently open by another user. Your changes WILL be
saved")
End If
End Function
'check in Item_Write and if True then Item_Write = False
'in Item_Close if Item.UserProperties("ReadOnly") then set it False and
set blnReadOnly False and save.
Function Item_Write()
if blnReadOnly=true then
item_write=false
msgbox ("Remember " & application.getnamespace("MAPI").currentuser &
" This item IS ALREADY OPEN by the user - " &
item.userproperties("ItemOpenUser") & ". Your changes WILL NOT be
saved")
else
item_write=true
msgbox ("Hooray " & application.getnamespace("MAPI").currentuser & "!
This item is NOT currently open by another user. Your changes WILL be
saved")
end if
End Function
Function Item_Close()
If Item.UserProperties("ReadOnly") Then
msgbox ("Did your changes get saved " &
application.getnamespace("MAPI").currentuser & " ? I think not!")
blnReadOnly = false
item.save
else
msgbox ("As you save and close this item " &
application.getnamespace("MAPI").currentuser & ", you'll be happy to
know that your changes WILL be saved")
blnReadOnly=true
End If
End Function