Hi,
I have an MS Access 2010 database with a module called bas This module reads the fields on a Microsoft Word document and then the data is loaded to a linked SQL Server 2008 R2 table. I am currently desigining this module so I am the only user using this database. I open the MS Access database, open the code for the module and click on Debug>Run. I get the following error:
-2147467259: The Database has been placed in a state by user ‘Admin’ on machine ‘JITC-PC’ that prevents it from being opened or locked.
How do I get rid of this error? Does any one have a solution? I have searched the Internet all week but haven't found a solution that works.
Here is my code: - Sub GetWordData()
-
Dim appWord As Word.Application
-
Dim doc As Word.Document
-
Dim cnn As New ADODB.Connection
-
Dim cnn2 As New ADODB.Connection
-
Dim rst As New ADODB.Recordset
-
Dim rst2 As New ADODB.Recordset
-
Dim strDocName As String
-
Dim blnQuitWord As Boolean
-
-
On Error GoTo ErrorHandling
-
-
strDocName = "\\JITC-PC\Users\Sharon\My Documents\GEOINT Repository\Requests\GEOINT_rep_req_form20111109 class.doc"
-
Set appWord = GetObject(, "Word.Application")
-
Set doc = appWord.Documents.Open(strDocName)
-
-
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
-
"Data Source=\\JITC-PC\Users\Sharon\Desktop\DEVELOPMENT.mdb"
-
-
-
' Open Requester table to load
-
rst.Open "dbo_Requester", cnn, adOpenKeyset, adLockOptimistic
-
-
With rst
-
.AddNew
-
!Requester_Organization = doc.FormFields("Req_Org").result
-
.Update
-
.Close
-
End With
-
-
doc.Close
-
-
If blnQuitWord Then appWord.Quit
-
cnn.Close
-
MsgBox "Requestor Data Imported!"
-
-
Cleanup:
-
Set rst = Nothing
-
Set cnn = Nothing
-
Set doc = Nothing
-
Set appWord = Nothing
-
-
Exit Sub
-
-
ErrorHandling:
-
Select Case Err
-
Case -2147022986, 429
-
Set appWord = CreateObject("Word.Application")
-
blnQuitWord = True
-
Resume Next
-
Case 5121, 5174
-
MsgBox "You must select a valid Word document. " _
-
& "No Data Imported.", vbOKOnly, _
-
"Word Document Not Found"
-
Case 5941
-
MsgBox "This Field is not found in the Word Document." _
-
& "No Data Imported.", vbOKOnly, _
-
"Fields not found in the Word Document"
-
Case Else
-
MsgBox Err & ": " & Err.Description
-
End Select
-
GoTo Cleanup
-
-
End Sub
Thank you for any help you can give me.
Sharon Chapman
5 38111 zmbd 5,501
Recognized Expert Moderator Expert NeoPa 32,569
Recognized Expert Moderator MVP
That error message means that the database is already open, and that whoever has it open is making design changes.
Almost everyone is user 'Admin' as far as Access is concerned.
In most cases, in the situation as you describe it, the other user is actually you. Either on the same PC or another one.
As NeoPa said, the other user is usually you. That is the case here. When you open the db Access creates a lock file and that lock file is preventing you from doing what you are trying to do.
The main problem is that you are trying to create a connection object to the db that you working in. You are already in the db, so why would you need to connect to it? Basically, you just need to open the recordset via a database object and use the .OpenRecordset method of that database object.
zmbd 5,501
Recognized Expert Moderator Expert
Sorry, We've been on vacation, and still am :), and haven't had any real access ( access... funny... I do have a dry sense of humor... :) )) outside of dialup for the past week...
SharonC:
Working with NeoPa and Dsatino's posts and the fact that you mention an SQL server in your orginal post I now am not too sure as to what you have going here...
From what I'm getting... it sounds like you have a front-end Access DB that is connecting to a back-end Access DB that is somehow linked to the SQL-Server mentioned in OP... is this correct? (and if so... like wow)
Second, you have failed to mention at what point your code is generating the error. Without that information it is impossible to help you troubleshoot your code! NeoPa was good enough to wrap your code in the OP so you can refer to the point by line... I'm suspecting that this is happening at line 17???
You may want to take a look at the following http://msdn.microsoft.com/en-us/library/ms807027.aspx and the related links therein... I have not worked enough with the ADO datatypes; however, working with the information in the links in my original replies and from Neo and Ds - I suspect that you're error may have to deal with connection.
Best of luck and I hope to get back to regularly posting in the next week or so :-)
-z
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: CAS |
last post by:
Hi,
New on the group so forgive me if this is a FAQ...
I've been looking for a tool to handle user admin (for a website I'm
knocking together for a club), after all there is no point reinventing the
wheel...
I need something that is easy to implement, but I'm not too bothered about
the actual administration side of things as we'll have a reasonably static
|
by: jamesa |
last post by:
I am a beginner and trying my first C# application.
Any reason why I am getting the message Login failed for user 'admin'
I have thoroughly checked the security settings in the sql server.
Find my code below.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
|
by: Rey |
last post by:
Howdy all.
Was wondering if there is any resolution for err 3734:
"The database has been placed in a state by user X on machine Y that
prevents it from being opened or locked."
I've spent time reearching err and found no real solution but then
maybe I stopped reading posts to soon 8-)
Believe this occurs after either an err has occurred and/or I've
|
by: daniel |
last post by:
Hi All,
I have a form and VB code in Access. The code is like
With rs
.Edit
!Field = 10
.Update
End With
|
by: Ramtin |
last post by:
Hi; when I use sql server connection or ole connection for working with
database I receive the login failed for user 'any user that I work'.I've been
granted ASPNET user in sql.
| |
by: Briansmi1116 |
last post by:
I have a database that I created to be used by several people on a network. Every now and then, when someone has it open, and another wants to open it they get this error; "The database has been placed in a state by user <name> on machine <name> that prevents it from being opened or locked. (Error 3734)."
Is there a reason this is happening, because I can sometime access the database when the same person has it open. Is there somethin I can...
|
by: ejamnadas |
last post by:
Hello,
I'm recieving the following run-time error:
Database has been placed in a start by user 'Admin" on machine 'Machine' that prevents it from being opened or locked.
This is the code that I get the error on
MyDB = "H:\DataManagement.mdb"
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyDB
|
by: tokcy |
last post by:
Hi everyone,
I need the world database of country state and city. Actually i have three drop down option in my project in 1st drop down country name should come from database and 2nd drop down state name should come from database according to country and in 3rd drop down cities name should come from database according to states.
I have tried many search engine but i could not get any proper info regarding this i mean some time i get whole...
|
by: smadadi |
last post by:
When iam trying to save changes to some of the reports i am getting the error message as 'Couldn't save currently locked by user admin on machine <name>'
happening with only some of the reports not with all.
Can any one help me?
|
by: atoy |
last post by:
Good day,
When i create a new blank database, when i go in the user group and permissions and then i click on change owner tab.
I notice that the user Admin is always the current owner of the database.
Some one can tell me what i have to do to set as the current owner of a database, when i create a new blank database ?
Thanks.
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |