Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single user, designing module, err: database has been placed in a state by user 'Admin

Status
Not open for further replies.

sharonchapman7

Programmer
Aug 31, 2011
45
US
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
 
When I see this, it means I've got Access, and a table in design mode.
Save the table layout and re-run...
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top