Charlotte Foust
cfoust at infostatsystems.com
Tue Aug 16 10:46:51 CDT 2005
Glad you found the problem and the answer, John. One of the plagues on my existence is when all the code runs as you step through it and then throws an error on the End Sub line!! Tracking that down usually has me beating my head against the walls because the error in question is often entirely unrelated to the sub itself! :-{ Charlotte Foust -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Monday, August 15, 2005 6:03 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Database close bug (apparently) resolved Well... It appears that my bug has been resolved. The form in question has a combo, the list for which is a result of a state machine. IOW, if you are in state A, then you can go to state B, D, F or G but not C, E etc. Thus the list for the combo has to be calculated as the form opens based on the current state, a SQL statement generated and placed in the combo rowsource property. In fact, for troubleshooting purposes, I had a saved querydef which I modified with the results of this calculated SQL Statement, then placed the name of the saved query in the combo's RowSource property after the calculation, and modification of the querydef. Once I knew that it was this class that was causing the issue, I was able to "divide and conquer" (comment out statements until it was found) and discovered that it was the process of modifying the saved querydef that was causing the unexpected close. The combo RowSource is set to the name of the saved query when the form opens, then the RowSource is set to "" (cleared), the querydef opened and the SQL property modified with the calculated SQL statement and closed, then the name of the query placed back in the combo which causes the combo to "requery" and pull the data per the SQL statement and display that dataset. For whatever reason, that modify/save/store in combo process was causing the close issue. By simply deleting the named query from the combo's RowSource, then placing the SQL statement itself directly in the combo, the database no longer closes unexpectedly. Now I have to do a "Find" to make sure that the stored query is not used any where else after the combo is loaded, and if not, I can just leave things as they are with a note in the commented out code to indicate that it caused my "database close" issue. What a PITA. And why doesn't Access close immediately (or better yet, throw an error if it doesn't like this?) when I am screwing around with the querydef instead of after OnCurrent finishes? And what is it that makes it OS sensitive? All things I will no doubt never see the answer to. But... I have fixed my problem. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com