Hi all, trying to create a recordset through ADO in Access. Got my code behind a button on a form (just at experimental stage). I have replicated the code from that I used in a VB form on a different project but when I try to9 execute the code I just keep getting an eror message with " the database has been set in a state that prevents it being opened or locked". I've got no tables or other forms opened so what's the deal? My code is as below:
Private Sub Command0_Click()
Dim cnABOF As ADODB.Connection
Dim rsUser As ADODB.Recordset
Dim strConnection As String
Set cnABOF = New ADODB.Connection
Set rsUser = New ADODB.Recordset
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "C:\Documents and Settings\Lol\Desktop\Project 26th March\Database\French.mdb;" ' text for connectionSet rsUser = New ADODB.Recordset
cnABOF.Open strConnection
With rsUser
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "tblUser", cnABOF, , , adCmdTable
.MoveFirst
End With
End Sub
Hope someone can shed some light, thanks, Lol
Private Sub Command0_Click()
Dim cnABOF As ADODB.Connection
Dim rsUser As ADODB.Recordset
Dim strConnection As String
Set cnABOF = New ADODB.Connection
Set rsUser = New ADODB.Recordset
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "C:\Documents and Settings\Lol\Desktop\Project 26th March\Database\French.mdb;" ' text for connectionSet rsUser = New ADODB.Recordset
cnABOF.Open strConnection
With rsUser
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "tblUser", cnABOF, , , adCmdTable
.MoveFirst
End With
End Sub
Hope someone can shed some light, thanks, Lol