X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6BACF30E570 for ; Thu, 12 Jun 2003 16:02:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 92122-04 for ; Thu, 12 Jun 2003 13:01:53 -0300 (ADT) Received: from web13806.mail.yahoo.com (web13806.mail.yahoo.com [216.136.175.16]) by svr1.postgresql.org (Postfix) with SMTP id 1962730E649 for ; Thu, 12 Jun 2003 13:01:52 -0300 (ADT) Message-ID: <20030612160146.43015.qmail@web13806.mail.yahoo.com> Received: from [216.173.173.66] by web13806.mail.yahoo.com via HTTP; Thu, 12 Jun 2003 09:01:46 PDT Date: Thu, 12 Jun 2003 09:01:46 -0700 (PDT) From: Chris Gamache Reply-To: cgg007@yahoo.com Subject: Re: VB Resync To: MRGonzalez , pgsql-odbc@postgresql.org In-Reply-To: <3EE8A211.000003.01780@GUAJ215DESA> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200306/23 X-Sequence-Number: 2997 If you're application is designed to run only with PostgreSQL, let PostgreSQL keep track of the current value of the serial: dataenvironment.connection.execute "Insert Into Detail (FK, Field1, Field2, FieldN) select currval('whatever_the_PK\'s_sequence_name'),'" & intData1 & "','" & intData2 & "','" & intDataN & "');" HTH --- MRGonzalez wrote: > I have an application where I save the information of a bill and its detail. > The PK of the header its a serial. > > I need to save the header and get the number of the serial to save it as a > FK in the detail. > > This is the way I wrote but it raise an error: > > header.recordset.update > header.recordset.resync adAffectCurrent, adResyncAllValues > > dataenvironment.connection.execute "Insert Into Detail (FK, Field1, Field2, > FieldN) Values (" & header.recordset!PK & "," & intData1 & "," & intData2 & > ," & intDataN & ")" > > Any suggestions? > > Thank you in advanced, > > > MAGO __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com