This is the error I get when I try to update a database field.
Run-time error'-2147467259(80004005)':
[Microsoft][ODBC dBase Driver] Cannot update. Database or object is read-only
I've already checked the read only property to my database and it is not set to read only. I also made sure that a previous "rs" was closed before reconnecting.
Here is my code:
in a module
Public Conn As New ADODB.Connection
Public RS As New ADODB.Recordset
Public StrFileName As String
Private Sub Form_Load()
Conn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
"DriverID=277;" & _
"Dbq=" & App.Path & "\db\"
End Sub
on a different form is where I try to connect and update the database.
Private Sub CmdMenu_MouseDown(Index As Integer, button As Integer, Shift As Integer, X As Single, Y As Single)
StrFileName = "buttons.dbf"
RS.Open "Select * from buttons", Conn, adOpenKeyset, adLockOptimistic, adCmdText
RS.MoveFirst
Do Until RS.EOF
If RS.Fields("MENU_ID") = NdxValue Then
RS.Fields("BLEFT") = FrmMenuDesign.CmdMenu(NdxValue).Left
RS.Fields("BTOP") = FrmMenuDesign.CmdMenu(NdxValue).Top
RS.Update
RS.Close
Exit Sub
End If
RS.MoveNext
Loop
End If
End If
rs.close
End Sub
The line causing the run-time error is rs.update. I can read the database without any problems. Oh yeah, I've already added the ado 2.1 Library reference.
Anyone have any ideas
thanks in advance
Run-time error'-2147467259(80004005)':
[Microsoft][ODBC dBase Driver] Cannot update. Database or object is read-only
I've already checked the read only property to my database and it is not set to read only. I also made sure that a previous "rs" was closed before reconnecting.
Here is my code:
in a module
Public Conn As New ADODB.Connection
Public RS As New ADODB.Recordset
Public StrFileName As String
Private Sub Form_Load()
Conn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
"DriverID=277;" & _
"Dbq=" & App.Path & "\db\"
End Sub
on a different form is where I try to connect and update the database.
Private Sub CmdMenu_MouseDown(Index As Integer, button As Integer, Shift As Integer, X As Single, Y As Single)
StrFileName = "buttons.dbf"
RS.Open "Select * from buttons", Conn, adOpenKeyset, adLockOptimistic, adCmdText
RS.MoveFirst
Do Until RS.EOF
If RS.Fields("MENU_ID") = NdxValue Then
RS.Fields("BLEFT") = FrmMenuDesign.CmdMenu(NdxValue).Left
RS.Fields("BTOP") = FrmMenuDesign.CmdMenu(NdxValue).Top
RS.Update
RS.Close
Exit Sub
End If
RS.MoveNext
Loop
End If
End If
rs.close
End Sub
The line causing the run-time error is rs.update. I can read the database without any problems. Oh yeah, I've already added the ado 2.1 Library reference.
Anyone have any ideas
thanks in advance