At the risk of oversimplifying my situation, here are the basic facts:
* I'm writing an ACCESS 2002 VBA.
* My VBA automatically uses information in one table (Table A) to repeatedly query a second table (Table B) via SQL.
* Each record in Table A (which has about 800 records) represents a set of conditions by which to query Table B.
* The VBA analyzes the recordset returned by the query of Table B, and writes the results back into Table A before moving to the next record in Table A and querying Table B again.
* The table being queried (Table B) has about 65,000 records, so the query takes a few seconds.
* The problem is that my VBA code continues to execute before the query of Table B is finished. Consequently, the resulting recordset from Table B it is incomplete and the analysis of it produces inaccurate results.
How do I tell Access (or VB) to wait for the query of Table B to finish before continuing with the rest of the code?
Any assistance is greatly appreciated.
Scott
* I'm writing an ACCESS 2002 VBA.
* My VBA automatically uses information in one table (Table A) to repeatedly query a second table (Table B) via SQL.
* Each record in Table A (which has about 800 records) represents a set of conditions by which to query Table B.
* The VBA analyzes the recordset returned by the query of Table B, and writes the results back into Table A before moving to the next record in Table A and querying Table B again.
* The table being queried (Table B) has about 65,000 records, so the query takes a few seconds.
* The problem is that my VBA code continues to execute before the query of Table B is finished. Consequently, the resulting recordset from Table B it is incomplete and the analysis of it produces inaccurate results.
How do I tell Access (or VB) to wait for the query of Table B to finish before continuing with the rest of the code?
Any assistance is greatly appreciated.
Scott
Comment