You need dbSeeChanges only for a read/write navigable recordset.  For the
second one, do:

Set rstO = db.OpenRecordset("SELECT * FROM TableB;", _
  dbOpenDyanaset, dbAppendOnly)

You had the dbAppendOnly in the wrong place.

John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of tyki9799
Sent: Wednesday, May 03, 2006 1:46 AM
To: [email protected]
Subject: [ms_access] Adding a new record

Hi everyone!

I recently upsized my Access database to SQL Server (MSDE sp4).
I now have an .adp file which I use to manage the database (an
interface to the MSDE backend) and an mdb file that holds the UI
(forms, etc.). The .mdb file has the MSDE database tables linked to it
through ODBC. The application so far seems to run rather smoothly but
I get a few glitches.

Here is one: I have this code for getting values from TableA and get
them to a new record in TableB. It used to run fine prior to upsizing
but now a get an error message (the db.OpenRecordset "dbSeeChanges"
parameter was added after the upsizing).

     Dim db As DAO.Database, rstI As DAO.Recordset, rstO As DAO.Recordset

      Set db = DBEngine(0)(0)

      Set rstI = db.OpenRecordset("SELECT * FROM TableA WHERE... ;",
dbOpenDynaset, dbSeeChanges)
                           
      Set rstO = db.OpenRecordset("SELECT * FROM TableB;",
dbAppendOnly, dbSeeChanges)

      rstO.AddNew

      rstO!field1 = rstI!field1
      rstO!field2 = rstI!field2
      rstO!field3 = rstI!field3

      rstO.Update

      rstI.Close
      rstO.Close

      Set rstI = Nothing
      Set rstO = Nothing

When I run the code (through a command button) I get the following
error message:

"Run-time error '3251'. Operation is not supported for this type of
object."

The error is pointed to the "rstO.AddNew" statement.

Any clue of what's wrong and how to fix it?

Thanks in advance, Theodore






Yahoo! Groups Links











SPONSORED LINKS
Microsoft access database Database development software Database management software
Database software Inventory database software Membership database software


YAHOO! GROUPS LINKS




Reply via email to