Question : File Sharing Lock w/single user

OS -> SQL Server  DB->A2K  ProgLang-> VB  DataAccess-> DAO

In a SINGLE user environment with 1.5gig Ram and 120gig Drive, I am testing a program that loads and initializes only two tables.  The tables contain about 40K and 90K records, repsectively.  Each row is approximately 500 bytes. While testing, I encountered the following message:

 "Run-Time '3052' File Sharing lock count exceeded.  Increase Max Locks Per File registry."

When a query is executed, no more than six fields are selected.  It is typical for two unamed querydef parameter queries to be executing simultaneously; one in an outer loop and the other in an inner loop as a parameter query using an outer loop value for the parameter.  There are 6 different initialization subroutines during which  no forms or user input is required.  All recordsets are closed and set to nothing as a matter of practice.

According to docs, this occurs in three differerent scenarios:
1) synchronizing two replicas.
2) running a Visual Basic for Applications procedure that uses the Synchronize method
3) process many transactions in a multi-user environment

The issue was resolved last time by dropping and recreating the tables.  One attempt to reselve the problem was to insert the DBEngine.Idle in various places in the code which has proven uineffective.  Another avenue considered was the property: UseTransaction but according to docs it is set to false for applications that use querydef so nothing.
(Is this true?) From what I can tell, the cause is related to the action queries on a large number of records. But this program has been executed at least 100 times since I last rebuilt the tables.  

The issue has resurfaced and none of the scenarios seem to apply to this situation.   My resolution is rather drastic and this will probably become an issue when multiple uses enter the picture.  

1) I would like to understand how these locks are allocated and deallocated b/c my program is allocating but apparently not deallocating; there is only one user and rebooting the machine or database repair doesn't deallocate.
2) Given my description, what is the likely cause of the error and how to resolve?
3) Is there a way to display the properties of an unamed query prior to execution?  If so, how can the default properties be changed?
4) Is there a way to check and display during application execution for the total number of file locks and the number available at different points during execution.  If so, what would the sub be?

Let me know if more information is required and please refrain from using links.  

Thank-you,
Glass  

Answer : File Sharing Lock w/single user

Glass

the link that led me to believe that indexes were the problem is here: http://dbforums.com/arch/106/2002/5/377388

As for a brief explanation, it was just a thought on my part. Trying to re-capture that thought, it went something like this. Whenever you try to alter an autonumber or a an index that allows no duplicates, you get an error, basically the field is locked. Hence my mental association with file sharing locks. You can however overwrite indexes and such with vba, so then access has to try and re-syncronise it's index collection internally.

Anyway everywhere I researched your question I seemed to find syncronisation issues associated, because you stated that you were executing action queries on a large number of records, I simply wondered if this was invoking some internal syncronisation.

You probably know as musch about it as I do Glass.

Regards Alan
Random Solutions  
 
programming4us programming4us