Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking problem

Status
Not open for further replies.

bjd4jc

Programmer
Nov 8, 2001
1,627
US
Hello all;

I posted this in an Access forum but didn't really get anything useful so I thought I would post it here too. I appreciate any suggestions or ideas because I am fresh out.

I have an access database that I use VB to connect to for a clock in/out program. There are 7 computers that log in/out times and 6 of them are used heavily pretty much at the same time.

I am using ADO to access the database. I get the an error that says: "could not update; currently locked". I know that the error happens on both DELETE and INSERT statements.

The logic of the program is this:

User chooses In or Out
User Enters their employee number
If "In" then check to see if they are already in
If they are clocked in then display message
Else OK
Else
OK

User is asked if they are sure
If the user is sure then Clock In/Out
If Out then delete from "ClockedIn" table
Else Add to "ClockedIn" table

Display main screen again

I am getting the error in the part where they delete from or insert into the ClockedIn table. It doesn't happen consistantly whatsoever. I am stumped. Does anyone have any ideas of why or how this is happening and what I can do to fix it?
 
What kind of cursor lock are you using for your connections? If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Here is how I open the database:

dbTime.Provider = "Microsoft.Jet.OLEDB.4.0"
dbTime.Open dbPath

and I open my database using

set rs = db.Execute(stsql)

I am not sure what the cursor lock is,,, whatever default is. Could it be Share Deny None? does that sound familiar?
 
There is a lot of info to deal with regarding the cursor type and and lock type of a recordset. There is too many to write the whole thing out but if you search MSDN on "Cursor" you will find lots of info. The defaults will not allow you to do what you are looking to do. I think that is what your problem is from though. I realize that this does not give any details but I hope it give you something to look at as a starting point anyway. Good luck. If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
I'm using a similar setup to bjd4jc (VB to Access). I've found that when trying to delete or update using a recordset that has an INNER JOIN in the select will give this error. I just changed the query set up so it didn't use INNER JOIN and the error went.

Hope this helps.
 
The Share Deny None it's OK , try to change the SQL statment or look at right to acces in databasae .
Good luck .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top