-
Re: ADO - will not update a linked dbf but does update other tables
Sue,
Thanks for your responce..
Yes I can add and delete records to the linked dbf with access...
I think for some reason the linked table is defaulting to a read only state.
I have redone the code to be a little more simplistic:
Private Sub Form_Load()
strConn = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\sigiado\SigiADO.mdb;" & _
"Uid=admin;" & _
"Pwd=;"
Set oConn = New ADODB.Connection
oConn.Open strConn
Set RSTsap = New ADODB.Recordset
strSQL = "SELECT * FROM testdbf"
rstSAP.CursorLocation = adUseServer
rstSAP.CursorType = adOpenDynamic
rstSAP.LockType = adLockPessimistic
rstSAP.Open strSQL, oConn, adOpenDynamic, adLockPessimistic
rstSAP.AddNew
rstSAP.Fields("fname") = "Fred"
rstSAP.Fields("lname") = "Smith"
Z = rstSAP.CursorType
A = rstSAP.CursorLocation
rstSAP.Update
'**** I get an error here saying the database is read only
'If I use an Access generated table I can update...
End Sub
"Sue Harsevoort" <SusannaH67@hotmail.com> wrote:
>Can you change data in the table if you open it in Access. I don't have
>experiance using linked dbf tables in Access, but I have used linked SQL
>server tables in Access. I know that in order to be able to update my
>linked tables they either have to have a primary key set up in SQL or when
I
>link the table I have to selete the fields that uniquely identify the
>records. So maybe the problem is that this wasn't done when the table was
>added to Access so it won't let you update it.
>
>Sue
>
>"lewis Keim" <lewkeim@wt.net> wrote in message news:3cfbcfee$1@10.1.10.29...
>>
>> I am new to this game so have mercy.
>>
>> I have an ACCESS mdb with 2 tables one is standard Access and the other
is
>> a linked dbf table.
>>
>> I can update the Access table but the DBF I get an error 'Can not update
>> object is read only..."
>>
>> Here is the code:
>>
>> STRcONN = "Driver={Microsoft Access Driver (*.mdb)};" & _
>> "Dbq=c:\sigiado\SigiADO.mdb;" & _
>> "Uid=admin;" & _
>> "Pwd=;"
>> Set oConn = New ADODB.Connection
>> oConn.Open strConn
>>
>> 'this works with the access table
>> '********* Working******
>> Set rstSap = New ADODB.Recordset
>> strSQL = "SELECT * FROM gemsMDB
>> '
>> '****** Failes to update
>> 'this says read only when I try to update - all i did was change tables
>> Set rstSap = New ADODB.Recordset
>> strSQL = "SELECT * FROM gemsDB
>> '************
>>
>> rstSap.CursorLocation = adUseServer
>> rstSap.CursorType = adOpenDynamic
>> rstSsap.LockType = adLockPessimistic
>> rstSap.Open strSQL, oConn, adOpenDynamic, adLockPessimistic
>> RSTsap.AddNew
>> RSTsap.Fields("act") = "F101"
>> RSTsap.Update
>>
>>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks