Update from a different database

Ben_Entrew

Registered User.
Local time
Today, 14:00
Joined
Dec 3, 2013
Messages
177
Hi all,

I try to update a table with a table from another database.

Somehow it shows me this error message:

Run-time error '-2147467259 (80004005)':
[Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by user 'Admin' on machine 'xxxx' that prevents it from being opened or locked.

Code I used:

Code:
Sub UpdatePublicDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdatePublicDatabase_OpenError
con.Open _
        "Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
        "Dbq=C:\Users\ELB2BU\Desktop\ACCESS_PROJECT\TEST.accdb;" & _
        "Exclusive=1;" & _
        "Uid=admin;" & _
        "Pwd=;"
On Error GoTo 0
con.Execute "DELETE FROM TRP"
con.Execute "INSERT INTO TRP SELECT * FROM [MS Access;DATABASE=" & Application.CurrentDb.Name & ";].[TRP_2013]"
con.Close
Debug.Print "Done."
Exit Sub

UpdatePublicDatabase_OpenError:
Debug.Print "Exclusive 'Open' failed. Quitting."
Exit Sub

End Sub

Does anyone has a clue ? What can I do here?

Thanks in advance.

Regards,
Ben
 
Any reason why you have opened the file Exclusively? I think that is the problem.
 
Hi Paul,

there was no special reason for that.

In the meanwhile I found out that an usual link to this table will also work out for me. Thanks.


Regards,
Ben
 

Users who are viewing this thread

Back
Top Bottom