Hello!
I'm using Access 2003 and MyODBC 5.1 driver to connect to a remote MySQL server.
I have to connect from code, because I have timeout issues (which can not be resolved from MyODBC 5.1 driver interface; no more "Initial statement" option).
Anyway after a painful process of getting this to work from code I have a problem that I seem to be opening the tables in read-only mode.
Where is the problem? I want to have read/write acces.
Here's the code:
I'm getting Run-time ERROR 3027 - "Cannot update. Database or object is read-only."
Thanks in advance!
Miha
I'm using Access 2003 and MyODBC 5.1 driver to connect to a remote MySQL server.
I have to connect from code, because I have timeout issues (which can not be resolved from MyODBC 5.1 driver interface; no more "Initial statement" option).
Anyway after a painful process of getting this to work from code I have a problem that I seem to be opening the tables in read-only mode.
Where is the problem? I want to have read/write acces.
Here's the code:
Code:
Dim wsODBC As Workspace
Dim db As Database
Dim rs As DAO.Recordset
Dim conODBC As Connection
Dim qdef As QueryDef
Dim baza As String
Dim user As String
Dim pass As String
Dim connect As String
Dim dsn As String
baza = "baza"
user = "user"
pass = "pass"
dsn = "PD"
connect = "ODBC;" & "DATABASE=" & baza & ";DSN=" & dsn & ";UID=" & user & ";
_PWD=" & pass & ";STMT=180"
Set wsODBC = CreateWorkspace("NewWorkspace", "admin", "", dbUseODBC)
Set db = CurrentDb
' še s povezavo
Set conODBC = wsODBC.OpenConnection("con1", dbDriverNoPrompt, False, connect)
Set rs = conODBC.OpenRecordset("SELECT * FROM cscart_users;", dbOpenDynamic)
With rs
.MoveFirst
Do Until rs.EOF
If rs![user_id] = 23 Then
.Edit
![firstname] = "Aljosa"
.Update
End If
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
qdef.Close
Set qdef = Nothing
db.Close
Set db = Nothing
conODBC.Close
Set conODBC = Nothing
wsODBC.Close
Set wsODBC = Nothing
I'm getting Run-time ERROR 3027 - "Cannot update. Database or object is read-only."
Thanks in advance!
Miha