G
Guest
I have a SQL Server 2000 stored procedure which tests fine and works
perfectly when
you manually launch it as a pass-through query in Access. What this proc
does is
simply find a record, set a safety lock field to True, then pass back to the
client
index number of that record. That's all.
The bizarre problem I have is when you invoke the pass-though query via VBA
code, it
launches twice instead of just once!! Only one record ID is passed back
while two
records get locked?? How??
<<< PROCEDURE CODE >>>
CREATE PROCEDURE GetAndLockOneRec
AS
DECLARE @outputparam2 numeric
SET @outputparam2 = (SELECT TOP 1 ScriptLockKey FROM dbo.Table1 WHERE
(APPL_RESULT IS NULL) AND RECORD_LOCK=0)
UPDATE dbo.Table1 SET RECORD_LOCK=1 WHERE ScriptLockKey = @outputparam2
SELECT @outputparam2 'ScriptLockKey'
GO
<<< Access Code to call this pass-through query >>>
Dim VarX As Variant
VarX = DLookup("[ScriptLockKey]", "qry_GetAndLockOneRec")
perfectly when
you manually launch it as a pass-through query in Access. What this proc
does is
simply find a record, set a safety lock field to True, then pass back to the
client
index number of that record. That's all.
The bizarre problem I have is when you invoke the pass-though query via VBA
code, it
launches twice instead of just once!! Only one record ID is passed back
while two
records get locked?? How??
<<< PROCEDURE CODE >>>
CREATE PROCEDURE GetAndLockOneRec
AS
DECLARE @outputparam2 numeric
SET @outputparam2 = (SELECT TOP 1 ScriptLockKey FROM dbo.Table1 WHERE
(APPL_RESULT IS NULL) AND RECORD_LOCK=0)
UPDATE dbo.Table1 SET RECORD_LOCK=1 WHERE ScriptLockKey = @outputparam2
SELECT @outputparam2 'ScriptLockKey'
GO
<<< Access Code to call this pass-through query >>>
Dim VarX As Variant
VarX = DLookup("[ScriptLockKey]", "qry_GetAndLockOneRec")