Using a recordset with Oracle tables

D

Daniel

I am using Access2000 and would like to insert/update
rows in an Oracle table(MA) that is defined as a link in
my Access MDB. Can I use a Recordset such as

Dim rst2 As Recordset
Set dbs = CurrentDb
Set rst2 = dbs.OpenRecordset("MA")
rst2.Index = "PK1_KSMA"
rst2.Seek "=", "8WD404"
If rst2.NoMatch Then
rst2.AddNew
rst2!MA_KEY2 = "8WD404"
rst2!MA_PRICE_DISC1 = 19.55
rst2.Update
Else
rst2.Edit
rst2!MA_PRICE_DISC1 = 19.55
rst2.Update
End If
rst2.Close

Any help would be greatly appreciated. Thanks
 
B

Brendan Reynolds

No, Index and Seek can only be used with table-type recordsets, and you
can't open a table-type recordset on a linked table. You could use FindFirst
instead, or (usually more efficient) use a SQL statement with suitable
criteria to open a recordset containing only the record or records you need.
Something like ...

Set rst2 = dbs.OpenRecordset("SELECT * FROM MA WHERE KSMA = '8WD404'")

.... if 'KSMA' was the name of the field (note you need the name of the field
here, not the name of the index as when using Seek).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top