473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to avoid "Could not update: currently locked" when adding a new record

I have a continuous bound form on a FE stored on desktop of each user PC. The BE sits on a local network drive.
I have the default record locking to "No Locks" and Open Database Using Record Level locking.

All appears to work well, but periodically (several times a day) a user will get the message "Could not update; currently locked" (no error number).
This error seems to only occur as the first character of the new record is entered. There are several fields defaulted to equal to some unbound fields on the same form (see attached screen shot - though it is not clear due to screen resolution, this form is a tab control).

When the error is cleared (hit OK) the first character will appear in the appropriate field, but the Date field (supposed to be defaulted) is always blank - though other defaulted fields remain. Also, while the error message is display, the word "Calculating..." appears in the bottom left of screen. Am I interrupting the saving?

What could possibly be happening? How can I fix and/or capture and handle the error?

(I had some OnCurrent code to sync another subform on the same tab - error appears to continue even with code removed).

Thank you.
Attached Images
File Type: jpg ErroMsg.jpg (33.9 KB, 1618 views)
Jan 18 '10 #1
6 24274
nico5038
3,080 Expert 2GB
Hmm, found http://bytes.com/topic/access/answer...rrently-locked indicating it might be the access page lock that's causing this trouble.

Personally I don't have this "trouble" as I never insert records using the "New" record row. I force an insert by code and the user has to press OK or Cancel to continue. Thus the [Cancel] is used to delete the inserted row and as an additional feature I create my own unique ID using the DMAX() function.

Is this a possible solution for you too ?

Nic;o)
Jan 18 '10 #2
I have researched a lot about page and record locking, and I think I have my setup correct. Rewritting the database to work in an entirely different fashion is a possibility, but I like how this database currently works (when it works - which is 99% of the time) - wondering if I can find a true solution.
Is there something to do with multiple default fields? - given the behaviour I described in the original post.
I have indexed a number of fields - could that be a problem? Can you confict with the database trying to still save the last record, and update indexes etc. while quickly entering a new record?
Jan 19 '10 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Goto the form. Add an event procedure to the OnError
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2.     MsgBox "Error Occured, ErrNr:" & DataErr
  3. End Sub
That will give you the error number. Why Access doesn't always spit out the error number is beyond me....

Lets presume the error is 3041, you can then handle it with code like:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2.     If DataErr = 3041 Then
  3.         Response = acDataErrContinue
  4.     End If
  5. End Sub
The acDataErrContinue basicly means I dont care, lets proceed anyways (Probably not recomended). You can also try other methods to handle when this error occurs if you find the "real" problem. Note that all errors that are not 3041 will be shown normally (No worries, your not suppressing any other errors by adding this code.)
Jan 19 '10 #4
nico5038
3,080 Expert 2GB
The only other true solution I know is working with a form with only unbound fields and insert-update the data by code. This is however a lot more work than the INSERT before approach I described...

Nic;o)
Jan 19 '10 #5
Some good info guys. I will try capturing the error, and see what I can do with it.
I have begun building the completly upbound solution - but agree, it is a lot of work, and not as slick to the end user as my current solution. My current screen filters for date, shift and associate. How do I go about implementing your INSERT with code in this example, with a continuous form.

I would also like to try and understand what is going wrong here. Any one know an anwer to my other questions?
Is there something to do with multiple default fields? - given the behaviour I described in the original post.
I have indexed a number of fields - could that be a problem? Can you confict with the database trying to still save the last record, and update indexes etc. while quickly entering a new record?
Jan 19 '10 #6
nico5038
3,080 Expert 2GB
Basically you'll need to add an Insert button on the main form and set the "AllowAdditions" in the subform to "No".

I've attached a working sample based on this principle, but also based on the ObjectAction model. That implies that the datasheet subform is for filtering and sorting and that the New/Update/Delete/etc. actions are handled by a different form.

Notice that the table holds a number and no autonumber.

Nic;o)
Attached Files
File Type: zip Sample-Datasheet-ObjectAction-InsertBeforeNew.zip (126.1 KB, 529 views)
Jan 19 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Brian Maupin | last post by:
I have a refreshing webcam shot on my site and I was wondering if there was a way I could display how many people are currently viewing it? Thanks in advance.
1
by: Andrew Donnelly | last post by:
I am trying to update a memo field in a table from a form that I have created. The form is unbound, and once the user makes their changes, they have to click the continue button. Once the button...
3
by: David W. Fenton | last post by:
A very old app of mine that's been in production use, and largely unchanged since about 1998 has started recently throwing error 3188 (can't update, locked by another session on this machine) when...
11
by: Daniel Billingsley | last post by:
I've got a project I've been working on for a few weeks. I've been using the BindingSource control - I've got four of them on this particular form. This morning I went to view the report in the...
1
by: amindi | last post by:
Hi, I wrote a VB6 program to read some data records from a Ms Access database and to write them into a SQL server database.(I use Ms Access 2000 and SQL server 2000).After reading each record in...
2
by: CWogksch | last post by:
Hello, Everyone... My name is Chris Wogksch. I have a point of sale application developed in VB6 using MS Access 2003 as the database. I've been running versions of this app for over eight...
0
by: CWogksch | last post by:
Hello, Everyone... My name is Chris Wogksch. I have a point of sale application developed in VB6 using MS Access 2003 as the database. I've been running versions of this app for over eight...
0
by: Chuckk Hubbard | last post by:
The docs say to try to discover the URI on my own if this happens. Could I get a hand doing that? This isn't just something I want to solve on my machine, e.g. by changing my network setup or what...
0
by: Chuckk Hubbard | last post by:
OK, I think I have it. The Manual says to start a Name Server "using the ns command", and I figured out that means using the pyro-ns script. On Mon, Nov 10, 2008 at 10:49 AM, Chuckk Hubbard...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.