Newbie Why will this not update

K

Ken

Could anyone please tell me why I am getting,
"The database has been placed in a state by user'Admin' on machine XXX that
prevents it from being opened or locked"

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim Curconn As New ADODB.Connection
Dim x As Integer

Curconn.Open CurrentProject.Connection

For x = 1 To 6
Curconn.Execute "INSERT INTO Samples1 ( BIN, ID, Type, [Desc], Location,
[Date], [Time], SampledBy, AnalysisType, Lab, results )SELECT
asbestosbridge.BIN, asbestosbridge.S" & x & "ID, asbestosbridge.S" & x &
"Type, asbestosbridge.S" & x & "Desc, asbestosbridge.S" & x & "Location,
asbestosbridge.S" & x & "Date, asbestosbridge.S" & x & "Time,
asbestosbridge.S" & x & "SampledBy, asbestosbridge.S" & x & "AnalysisType,
asbestosbridge.S" & x & "Lab, asbestosbridge.S" & x & "results FROM
asbestosBridge WHERE (((asbestosbridge.S1ID)<>""));"
Next x
Curconn.Close

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub
 
D

Dan Artuso

Hi,
Don't open another connection, just use the one you already have.
CurrentProject.Connection.Execute "......."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top