Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / December 2007



Tip: Looking for answers? Try searching our database.

Error  -2147467259   Could not save; currently locked by another u

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 13 Nov 2007 03:07 GMT
Hi,
I am using VB 6 with Sp6 (XP sp2), Jet 4.0 and Access 2000 database.
I have one table it has Memo field and I am trying to save Memo filed that
time it gives me error
"-2147467259   Could not save; currently locked by another user."

While adding new records with same number of character is fine (more than
3000 Characters).
Here is the sample code
Private Sub Command2_Click()
Dim ssql As String
Dim cnn As New ADODB.Connection
cnn.Open gCnnstring
       ssql = "UPDATE Test_Memo SET Comment =" & Chr(34) & Trim(TxtInput) &
Chr(34)
       ssql = ssql & " WHERE Record_ID=" & mRecordID
       cnn.Execute ssql
cnn.Close
End Sub

Any help will appreciates.
Thanks
Jan Hyde (VB MVP) - 13 Nov 2007 11:52 GMT
Mike <Mike@discussions.microsoft.com>'s wild thoughts were
released on Mon, 12 Nov 2007 19:07:00 -0800 bearing the
following fruit:

>Hi,
>I am using VB 6 with Sp6 (XP sp2), Jet 4.0 and Access 2000 database.
[quoted text clipped - 18 lines]
>Any help will appreciates.
>Thanks

Well, it sounds like the record is locked... by another
user. I'm not sure why you think it's related to number of
characters.

I don't know access so I don't know how it handles
transactions and record locking, particularly when (as it
appears in your example) you are not performing updates as
part of a transaction. But this may be something you need to
sort out, you definitely need to cater for the circumstance
when a record is locked.

--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Mike - 13 Nov 2007 13:10 GMT
Thanks Jay for helping me.
I am the only one user using this database (MDB) using VB front end, I tried
Rs.update option also, It give me same error. I tried Access 2003 version MDB
also.
Looks like ADO/JET issue.
Thanks

> Mike <Mike@discussions.microsoft.com>'s wild thoughts were
> released on Mon, 12 Nov 2007 19:07:00 -0800 bearing the
[quoted text clipped - 38 lines]
>
> https://mvp.support.microsoft.com/profile/Jan.Hyde
Ralph - 13 Nov 2007 16:12 GMT
> Thanks Jay for helping me.
> I am the only one user using this database (MDB) using VB front end, I tried
> Rs.update option also, It give me same error. I tried Access 2003 version MDB
> also.
> Looks like ADO/JET issue.
> Thanks

Have you actually checked out the permissions? Don't guess. Write a simple
app to write and read a file to that location within the same environment as
your program is running.

That really looks like the app doesn't have full read/write/execute access
to the folder where the mdb file is located.

-ralph
Mike - 14 Nov 2007 00:15 GMT
Ralph,
Yes I have verified folder that contain mdb file and looks fine. I am able
to save other table information to same MDB file.
Thanks
Mike

> > Thanks Jay for helping me.
> > I am the only one user using this database (MDB) using VB front end, I
[quoted text clipped - 13 lines]
>
> -ralph
Mike - 16 Nov 2007 10:53 GMT
Any one have idea?  I don't think this is permission issue because I am able
to save
new record in the same table with memo text.
Thanks

> Ralph,
> Yes I have verified folder that contain mdb file and looks fine. I am able
[quoted text clipped - 19 lines]
> >
> > -ralph
Ralph - 16 Nov 2007 15:33 GMT
> Any one have idea?  I don't think this is permission issue because I am able
> to save
> new record in the same table with memo text.
> Thanks

<snipped>
This error as others have reported is most commonly caused by permission
problems with the folder where the mdb file is located. You have however,
dismissed this.

I think you said you are the only "User" (Admin Exclusive-Access????), so
the next step is to determine why Jet thinks there is another User. The
other option is that the error itself is bogus, and that there is actually
something else going on because of a difference in circumstance.

If I were in your shoes I would go back over the whole process of calling
this particular routine.

One thing you are doing that I would change is the use of the "As New"
declaration.
    Dim cnn As New ADODB.Connection

This is usually a bad idea. When you do this the code instruments the follow
'hidden' code for every call on the object...
   If cnn Is Nothing Then
       Set cnn = New ADODB.Connection
       cnn.Execute ...
   End If
So you saddle yourself with all this extra code. It also can hide problems,
because no matter where you call it you will get an initialized valid
object. But not necessarily the same object.

I would dump this declare in favor of specifically Newing a reference and
track that reference.
    Dim cnn As ADODB.Connection : Set cnn = New ADODB.Connection

We don't know anything about the context where this call is being made, but
consider that ADO has a thing called Connection Pooling. That means when the
ADODB library is first initialized it create a Pool based on the Connection
String. Subsequent calls get a connection from this pool. It is possible in
a tight loop you actually have more than one connection.

Anyway, rework the code to remove the "As New" declarations. Second, expand
your investigation beyond the single call and see if there isn't something
interesting in the context between the call that fails and those that
succeed.

Poor help I know, but one never knows. <g>

-ralph
rag2k - 19 Dec 2007 18:07 GMT
> able
> > to save
[quoted text clipped - 46 lines]
>
> -ralph

Set command
                   Lock  type      =  optimistic
                  Cursor type      =  Static
                  Cursor Location = Client Side

This should solve the problem
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.