VB4 Locking Tables ProblemFor example, I have a parameter query that gets fired that brings up data on a selected client. Once that query if fired, and the database is still open, I cannot go back into Access and alter that query. During development, it is often nice to realize there is something wrong with a query, so I will pause the program, change and save the query, and run that part of the program again. At least this works in VB 3. But not VB 4. This is also true of tables. Once a table has been read or saved to, I cannot make any changes to the table's structure at all, but you can in VB 3. And the biggest headache of all, is when the program is running and has finished editing or adding a record to a table, it is locked so that the same program on another machine, logged into the same DB, gets a locked error.
So, what is going on. I have tried many things, using Transactions before and after the EDIT/ADDNEW and UPDATE methods. Clearing the recordset and querydef objects to NOTHING when I'm done with them, and even setting the locked to optimistic all to no avail, I'm still getting sporadic locking between machines.
Anyone have any suggestions?
From: Richard Wakefield
Email: JRWakefield@msn.com
Firstly, add the following line to your code whenever you have finished doing some data access.
DBEngine.Idle vbFreelocks
You might also try adding a 'Set DBEngine = Nothing' statement to the end of your program. Possibly in the unload event of your last form, just make sure that it is after the last of your Data Access code. This line will unload the JET engine. This should mean that it no longer has any locks once this has executed. If the problem still persists I can only suggest that your reinstall VB4.
You should not be seeing this behavior so it may be due to a bad DLL and a reinstall should fix that.
I'm sorry I can't give you a definitive answer to this one, but I have been unable to actually reproduce the problem so I can only make recommendations based upon what it sounds like is happening.