473,699 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do I fix err: database has been placed in a state by user 'Admin

2 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. Sub GetWordData()
  2.     Dim appWord As Word.Application
  3.     Dim doc As Word.Document
  4.     Dim cnn As New ADODB.Connection
  5.     Dim cnn2 As New ADODB.Connection
  6.     Dim rst As New ADODB.Recordset
  7.     Dim rst2 As New ADODB.Recordset
  8.     Dim strDocName As String
  9.     Dim blnQuitWord As Boolean
  10.  
  11.     On Error GoTo ErrorHandling
  12.  
  13.     strDocName = "\\JITC-PC\Users\Sharon\My Documents\GEOINT Repository\Requests\GEOINT_rep_req_form20111109 class.doc"
  14.     Set appWord = GetObject(, "Word.Application")
  15.     Set doc = appWord.Documents.Open(strDocName)
  16.  
  17.     cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  18.         "Data Source=\\JITC-PC\Users\Sharon\Desktop\DEVELOPMENT.mdb"
  19.  
  20.  
  21.     ' Open Requester table to load
  22.     rst.Open "dbo_Requester", cnn, adOpenKeyset, adLockOptimistic
  23.  
  24.     With rst
  25.         .AddNew
  26.         !Requester_Organization = doc.FormFields("Req_Org").result
  27.         .Update
  28.         .Close
  29.     End With 
  30.  
  31.      doc.Close
  32.  
  33.     If blnQuitWord Then appWord.Quit
  34.         cnn.Close
  35.         MsgBox "Requestor Data Imported!"
  36.  
  37. Cleanup:
  38.     Set rst = Nothing
  39.     Set cnn = Nothing
  40.     Set doc = Nothing
  41.     Set appWord = Nothing
  42.  
  43.     Exit Sub
  44.  
  45. ErrorHandling:
  46.   Select Case Err
  47.   Case -2147022986, 429
  48.         Set appWord = CreateObject("Word.Application")
  49.         blnQuitWord = True
  50.         Resume Next
  51.   Case 5121, 5174
  52.         MsgBox "You must select a valid Word document. " _
  53.                 & "No Data Imported.", vbOKOnly, _
  54.                 "Word Document Not Found"
  55.   Case 5941
  56.         MsgBox "This Field is not found in the Word Document." _
  57.                 & "No Data Imported.", vbOKOnly, _
  58.                 "Fields not found in the Word Document"
  59.   Case Else
  60.         MsgBox Err & ": " & Err.Description
  61.   End Select
  62.   GoTo Cleanup
  63.  
  64. End Sub
Thank you for any help you can give me.

Sharon Chapman
Jul 20 '12 #1
5 38111
zmbd
5,501 Recognized Expert Moderator Expert
Can you open DEVELOPMENT.mdb directly?
IF so then make a backup of the file.

Try a compact and repair...

Which line is the error occuring?

-z

PS: your code should be inclosed in [code][/code] tags POSTING_GUIDELI NES: Please Read Carefully Before Posting to a Forum
Jul 20 '12 #2
zmbd
5,501 Recognized Expert Moderator Expert
something else to read: http://support.microsoft.com/kb/307640
Jul 20 '12 #3
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.
Jul 22 '12 #4
dsatino
393 Contributor
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.
Jul 23 '12 #5
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
Jul 31 '12 #6

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

Similar topics

1
1754
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
0
1570
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;
5
7892
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
12
10935
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
5
2296
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.
2
2197
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...
9
12284
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
7
9242
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...
4
4291
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?
1
1871
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.
0
9199
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, 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...
0
9055
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 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...
1
8945
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,...
0
8902
tracyyun
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...
1
6550
isladogs
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...
0
5889
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();...
0
4392
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...
1
3075
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
3
2016
bsmnconsultancy
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...

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.