Image of Navigational Panel mapped to Contents / Home / Search VB4 Locking Tables Problem
Tech Support Question

Image of Line Break

Q. Well, I have produced my first project in VB 4 and I'm going to have to give some serious thought about doing another. I have run into problems and major changes from VB 3 that I just cannot understand. The biggest headache at the moment is the locking of tables and queries AFTER the program is finished with them.

For 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

A. This is an odd problem, one which I have not experienced. Furthermore I have asked around some others who have used VB4 and they are also saying that they have not seen this behavior. Is this a problem with VB4 16bit or 32bit? It sounds like JET is not correctly releasing its locks for some reason or other. In general this should not be the case. There are a few things you can try, however, in an attempt to fix it.

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.


Image of Arrow to Previous Article Image of Arrow to Next Article

[TECH SUPPORT TOC]
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]