Hi List, I need some help.
Situation: I need to lock additional users from using a menu item if one
user is already using that item.
Solution: When the menu item is selected by the first user, a CONTROL
table is UPDATEd with the name of that 1st computer using that menu item.
Subsequent users then know who is running that menu item.
When the first user finishes, the CONTROL table is updated with
'Unlocked' so others can use the menu item.
The code is below. It works, 1st computer gets into the menu item, 2nd
computer gets the message that Computer1 is using the menu item.
Then, Computer 1 exits the menu item.
Problem: computer 2 still gets the message that Computer 1 is using the
menu item after CONTROL has been UPDATEd to "Unlock'.
CONTROL table is updated properly along the way and the code runs
properly in RB Editor, but doesn't run in the form.
The form is a variable menu form with a Group Bar; the code runs as
custom code for an item in a group.
Tracing the code, variable vBatesNbrLock does not get 'Unlocked'
SELECTed into it even thought that's the value in the CONTROL table.
R:Base 7.6 30119
Any ideas?
TIA
Doug
SET VAR +
vBatesNbr INTEGER, +
vBatesNbrLock TEXT, +
vivBatesLock INTEGER
----Test for Bates number being locked by a user
SELECT BatesNbrLock INTO vBatesNbrLock INDICATOR vivBatesLock +
FROM Control +
WHERE ControlDescr = 'Data'
IF vBatesNbrLock = 'Unlocked' THEN
UPDATE Control +
SET BatesNbrLock = .pComputer +
WHERE ControlDescr = 'Data'
ELSE
SET V vMsg TEXT = +
('Receipts are being entered on computer' & .vBatesNbrLock
+(CHAR(009))+ +
(CHAR(013))+ +
'Receipts can be entered on only one computer at a
time.'+(CHAR(009))+(CHAR +
(013)) )
PAUSE 2 USING .vMsg +
CAPTION 'Receipts' +
ICON ATTENTION +
OPTION MESSAGE_FONT_SIZE 11 +
|BACK_COLOR YELLOW
GOTO Done
ENDIF
--Temp PAUSE for testing
PAUSE 2 USI 'EDIT USING RcvEdit'
--Unlock Receipt entry so others can enter
UPDATE Control +
SET BatesNbrLock = 'Unlocked' +
WHERE ControlDescr = 'Data'
LABEL Done
CLEAR VAR +
vBatesNbrLock, +
vBatesNbr, +
vivBatesLock
RETURN