Saving manually to ODBC Linked Table?

mohsinhq

Registered User.
Local time
Today, 23:11
Joined
Aug 2, 2004
Messages
90
Hi,

I have built a form without a record source as i need to mess around with the fields before i save.

On save, i would like the form to save to an ODBC linked table in my database.

I save the record through a save button which has the following code attached to its on_Click event.

' NOTE: DAO 3.6 code
Dim db As Database
Dim rs As DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("tblODBCLinked", dbOpenTable)
With rs
.AddNew
.Fields("Country") = Me.txtCountry
.Fields("ID") = Me.ID
.Fields("Creation Date") = Now()
.Update
End With
rs.Close
Set rs = Nothing

I have no problem saving to a non-linked table with the above coding but always seems to fall over if as soon as i try to open the linked table. Ive debugged and the problem seems to be with opeing the table.

Set rs = db.OpenRecordset("tblODBCLinked", dbOpenTable)

Thanks in Advance for any suggestions

Access 97 / Windows NT / Full Read Write access. Not a permissions issue
 
Last edited:
Try

Set rs = db.OpenRecordset("tblODBCLinked", dbOpenDynaset)
 
Hey there,

I have been searching for this dbOpenDynaSet, it is a god send...

However being as curious as I am im trying to find what this command actually does that is so special...
 
Pace said:
Hey there,

I have been searching for this dbOpenDynaSet, it is a god send...

However being as curious as I am im trying to find what this command actually does that is so special...

As in the help file:

Opens a dynaset-type Recordset object, which is similar to an ODBC keyset cursor.

Keyset Cursor:
A set of rows that you can use to add, change, or delete rows from an underlying database table or tables. Movement within the keyset is unrestricted. A keyset cursor can contain columns from one or more tables in a database. Membership is fixed.
 

Users who are viewing this thread

Back
Top Bottom