473,406 Members | 2,345 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 do I fix err: database has been placed in a state by user 'Admin

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 38078
zmbd
5,501 Expert Mod 4TB
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_GUIDELINES: Please Read Carefully Before Posting to a Forum
Jul 20 '12 #2
zmbd
5,501 Expert Mod 4TB
something else to read: http://support.microsoft.com/kb/307640
Jul 20 '12 #3
NeoPa
32,556 Expert Mod 16PB
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 256MB
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 Expert Mod 4TB
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
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...
0
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...
5
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...
12
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
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
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...
9
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...
7
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...
4
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...
1
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...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.