B
Brian
I have a pass-through SELECT statement that triggers a sequence-generating
procedure in a DB2 db so that I can have it hand me the primary key I need to
use for appending records into the DB2 db.
When I manually run (double-click) the pass-through query, it correctly
increments the value by one each time I run the query and returns the
incremented value to me. However, when I call the pass-through query via VBA
so that I can assign the returned value to a variable or a control on a form,
it increments by 2:
i.e. ABC = Dfirst("[ReturnVariableName]","[PassThroughQueryName]" -> the
value of ABC will increment by two each time I run this code.
Worse yet, when I simply included the above statment in my append query to
generate the value of the primary key field , it incremented by 6!
What is happening? It is acting as though it is testing the validity of the
returned value with a "pre-query" (causing the procedure to run and increment
the value) without actually returning the value before it actually runs the
query (causing the procedure to run again) and returns the value (now
incremented a second time).
procedure in a DB2 db so that I can have it hand me the primary key I need to
use for appending records into the DB2 db.
When I manually run (double-click) the pass-through query, it correctly
increments the value by one each time I run the query and returns the
incremented value to me. However, when I call the pass-through query via VBA
so that I can assign the returned value to a variable or a control on a form,
it increments by 2:
i.e. ABC = Dfirst("[ReturnVariableName]","[PassThroughQueryName]" -> the
value of ABC will increment by two each time I run this code.
Worse yet, when I simply included the above statment in my append query to
generate the value of the primary key field , it incremented by 6!
What is happening? It is acting as though it is testing the validity of the
returned value with a "pre-query" (causing the procedure to run and increment
the value) without actually returning the value before it actually runs the
query (causing the procedure to run again) and returns the value (now
incremented a second time).