PDA

Click to See Complete Forum and Search --> : MsAccess via ODBC


Aug 22nd, 2000, 12:58 AM
please help! my boss is back in office tomorrow and I need a solution

I used an Access-Db via jet in the last five projects without any problems.

Now I should access the db via odbc and it doesn't work just as fine.
It's no problem to read data out of the tables but I'm not able to update or edit them.
Vb always complains that my db is write protected.


Dim wks As Workspace
Set wks = CreateWorkspace("wksTest", "Admin", "admin", dbUseODBC)

Dim dbs As Database
Set dbs = wks.OpenDatabase("Test", dbDriverNoPrompt, False, "ODBC;DSN=Test;")

Dim rsTest As Recordset
Set rsTest = dbs.OpenRecordset("SELECT * FROM Test", dbOpenDynaset)

With rsTest
.Edit
'runtime-error 3027
!strData = "Edited"
.Update
End With

With rsTest
.AddNew
'runtime-error 3027
!strData = "New"
.Update
End With

'works well
While (Not (rsTest.EOF))
Debug.Print rsTest!strData
rsTest.MoveNext
Wend

Debug.Print dbs.Updatable
'prints true

Debug.Print rsTest.Updatable
'prints false

Dim fld As Field
For Each fld In rsTest.Fields
Debug.Print fld.Name, CStr(fld.DataUpdatable)
'prints false
Next fld


thanks in advance
__________________
da_bob
vb6 enterprise, sp3, nt

AKA
Aug 22nd, 2000, 01:14 AM
I dont use Access but I suggest :

Set rsTest = dbs.OpenRecordset("SELECT * FROM Test", dbOpenDynaset,,dbOptimistic )

Because I think that the default for lockedits are dbReadOnly.

Aug 22nd, 2000, 01:19 AM
thanks for your reply but it didn't work either

The OpenRecordset with dbOptimistic resulted in
runtime error 3001.
_________________