General discussion
February 2, 2001 at 04:19 AM
dean.held

SQL 7 access using ODBC

by dean.held . Updated 25 years, 4 months ago

In Access 2000 if I link to a table in SQL 7 database I can edit the data. Hovever, if I use ODBC to go directly at the SQL 7 database I get an error:
“datbase or OBJECT is read only.”

The code is as follows:

Dim dbs, dbsAreaCode, dbsTables, dbsConv, dbsConsd As DataBase
‘ Dim dbCons As Connection

Dim wks, wksTables, wksConv As Workspace

Dim rstPhone, rstConfig, rstConv, rstTables As Recordset
Dim strConnect, sUser As String

Dim sPassword As String
Dim sServer As String
Dim sDatabase As String
Dim sPhone As String
Dim sTable As String

Set wks = CreateWorkspace(“”, “admin”, “”, dbUseODBC)
strConnect = “ODBC;DSN=” + sOdbc + “;UID=” + sUser _
+ “;PWD=” + sPassword + “;SERVER=” + sServer + “;DATABASE=” + sDatabase

Set dbCons = wks.OpenConnection(“con1”, , False, strConnect)
Set rstPhone = dbCons.OpenRecordset(sTable, dbOpenDynamic)

‘ Set wks = CreateWorkspace(“”, “admin”, “”, dbUseJet)
‘ Set dbConsd = wks.OpenDatabase(sDatabase, dbDriverNoPrompt, False, strConnect)


‘Get first table to process Area code changes

With rstPhone
rstPhone.MoveFirst
While Not rstPhone.EOF
.Edit

WHen it hits the edit I get the error.

Any ideas?

This discussion is locked

All Comments