Hello everyone
Can someone help me?
What is wrong with the following Visual basic code?
I can read a field in a record but I cant update the field.
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;driver=Microsoft dBase Driver (*.dbf);server=c:\;uid=;pwd=;database=mydatabase"
Dim rs As New Recordset
Set rs = New Recordset
rs.Open "select AMOUNT from C:\mydatabase\sales.dbf", db, adOpenStatic, adLockOptimistic
rs.MoveFirst
Do While Not rs.EOF
rs.Fields(0).Value = rs.Fields(0).Value * 2
rs.Update
rs.MoveNext
Loop
Using the above code; I can read the database but when I try to update a field I get the message:
"Run-time error '-2147467259(8004005)':
[Microsoft][ODBC dBase Driver] Cannot update. Database or object is read-only."
Can someone help me?
So what is wrong why cant I update a field?
Thanks
Burhan H. Afandi