Advertisement

02.04.2008 at 10:59AM PST, ID: 23135774
[x]
Attachment Details

DAO dsnless connection to mysql database opens as readonly

Asked by aragorn_gr in Access Coding/Macros, Visual Basic Programming, MySQL Server

Tags:

Hi,
I'm trying to add a record with vba to a remote mysql database table using a dsnless dao connection.

Unfortunately I keep getting the "Cannot Update. Database or object is read-only".

I am able to add records using a DSN connection so I think the problem is somewhere in the code I'm using.

Any ideas?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Public Sub testDsnless()
    Dim dbMySQL As Database
    Dim cnMySQL As DAO.Connection
    Dim rsMySQL As DAO.Recordset
    Dim sDSN As String, qrMySQL As String
    
    sDSN = "ODBC;DRIVER={MySQL ODBC 3.51 Driver};" _ 
& " SERVER=www.myserver.com;DATABASE=mydatabase;" _
& " UID=myusername;PWD=mypassword;"
    Set dbMySQL = OpenDatabase("", False, False, sDSN)
    
    qrMySQL = "SELECT * FROM tableName;"
    Set rsMySQL = dbMySQL.OpenRecordset(qrMySQL)
    
    rsMySQL.AddNew
    rsMySQL!ID = 1000
    rsMySQL.Update
End Sub
 
Loading Advertisement...
 
[+][-]02.04.2008 at 11:17AM PST, ID: 20817099

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.04.2008 at 11:21AM PST, ID: 20817124

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.04.2008 at 11:51PM PST, ID: 20821325

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.04.2008 at 11:57PM PST, ID: 20821348

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 07:48AM PST, ID: 20823921

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 07:53AM PST, ID: 20823970

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 08:14AM PST, ID: 20824129

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 08:18AM PST, ID: 20824180

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 08:26AM PST, ID: 20824268

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 09:28AM PST, ID: 20824943

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 09:30AM PST, ID: 20824959

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Visual Basic Programming, MySQL Server
Tags: vba, access, mysql
Sign Up Now!
Solution Provided By: TextReport
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.05.2008 at 09:42AM PST, ID: 20825060

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 09:43AM PST, ID: 20825071

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628