laptoprob
02-23-2006, 02:39 PM
My Database uses VB to update 3 tables using SQL when I select a Print Report button on my Form. Pressing one of 20 print Report buttons runs the SQL code to update these tables and then calls the "DoCmd.OpenReport stDocName, acViewPreview" to open the report and allow me to confirm the printout after viewing the report. This works fine on its own.
I have added an extra button that will loop through the code and call up each report from 1 to 20 the same as pressing the buttons. The problem is that as soon as the first report is generated and opened, the code then goes to generate the second report but has not got access to the three tables that are used by the Report and gives an error saying an other user or program is using the tables so it cannot update them. My report is the same report that is called up and always uses the same tables, the data in the tables though is changed by the VB code before the report is opened. Can anyone tell me how I can make the Subroutine wait until the Report has released the tables before it continues to update them to stop the error. I do not want to generate 20 different sets of tables and have 20 versions of the same report calling up the tables. Any Help / Suggestions will be appreciated. Thanks..
I have added an extra button that will loop through the code and call up each report from 1 to 20 the same as pressing the buttons. The problem is that as soon as the first report is generated and opened, the code then goes to generate the second report but has not got access to the three tables that are used by the Report and gives an error saying an other user or program is using the tables so it cannot update them. My report is the same report that is called up and always uses the same tables, the data in the tables though is changed by the VB code before the report is opened. Can anyone tell me how I can make the Subroutine wait until the Report has released the tables before it continues to update them to stop the error. I do not want to generate 20 different sets of tables and have 20 versions of the same report calling up the tables. Any Help / Suggestions will be appreciated. Thanks..