L
LarryP
I have a procedure that performs a series of tests on a
humongous dataset. Some of these tests involve first
running a MakeTable query on the big dataset, then a
second query against the newly created working table.
My problem: sometimes it appears that Access is trying to
run Step 2 before Step 1 is completed, resulting in an "I
can't find that table" error.
How would you suggest I go about putting Step 2 on hold
until I know for certain that Step 1 is done? I
considered putting Step 2 inside a "does the source table
exist" structure, but it seems to me if the answer is No,
the code would skip it altogether and move on to the next
test without this one ever getting done. Other clunky
workarounds also come to mind, but surely there must be
some kind of built-in, elegant answer to this problem.
(The relevant part of my code is shown below if anyone
needs to look at it before responding. Nothing esoteric
about it, I think it's just a timing/multithreading issue.)
*****************************************************
DoCmd.OpenQuery "qryTest11FailedItems" 'MakeTable query
DoCmd.OpenQuery "qryTest11CodeUpdate" 'uses above table
'sometimes fails here
DoCmd.OpenQuery "qryTest12FailedItems" 'MakeTable query
DoCmd.OpenQuery "qryTest12CodeUpdate" 'uses above table
'sometimes fails here
humongous dataset. Some of these tests involve first
running a MakeTable query on the big dataset, then a
second query against the newly created working table.
My problem: sometimes it appears that Access is trying to
run Step 2 before Step 1 is completed, resulting in an "I
can't find that table" error.
How would you suggest I go about putting Step 2 on hold
until I know for certain that Step 1 is done? I
considered putting Step 2 inside a "does the source table
exist" structure, but it seems to me if the answer is No,
the code would skip it altogether and move on to the next
test without this one ever getting done. Other clunky
workarounds also come to mind, but surely there must be
some kind of built-in, elegant answer to this problem.
(The relevant part of my code is shown below if anyone
needs to look at it before responding. Nothing esoteric
about it, I think it's just a timing/multithreading issue.)
*****************************************************
DoCmd.OpenQuery "qryTest11FailedItems" 'MakeTable query
DoCmd.OpenQuery "qryTest11CodeUpdate" 'uses above table
'sometimes fails here
DoCmd.OpenQuery "qryTest12FailedItems" 'MakeTable query
DoCmd.OpenQuery "qryTest12CodeUpdate" 'uses above table
'sometimes fails here