Extracting information from a newly inserted record 
Author Message
 Extracting information from a newly inserted record

Brief overview:

Access Front end, SQL Server back-end connected via ODBC

We have a system of batch updates which are processed by by Access and
updated,deleted or added to the server as needed.

OK: Now the problem:

We have a series of related tables: (simplified)

[Address] 1 -> many [Person] 1->many [Subjects]

On adding new records, I need to get the newly assigned ID (set by an
identity column in SQL Server), so that the related records will also
hold this same ID and therefore keep the data consistent.

However, on inserting the record and then going back to it,

....set fields in remote table to incoming values...
rsRemote.Update
rsRmote.MoveLast

this creates an error (which took ages to find!) ...DAO thinks that
the record has been deleted....

What is the best way to go about getting this information back to the
front-end?

dirc Evans



Sat, 10 Mar 2001 03:00:00 GMT  
 Extracting information from a newly inserted record
Try
rsRmote.Bookmark=rsRmote.LasModified
Best regards,
___________
Alex Dybenko
Point Limited

Home Page: http://www.geocities.com/SiliconValley/Heights/5091/
Moscow MS Access User Group
http://www.arimsoft.ru/msaccess
Quote:

>Brief overview:

>Access Front end, SQL Server back-end connected via ODBC

>We have a system of batch updates which are processed by by Access and
>updated,deleted or added to the server as needed.

>OK: Now the problem:

>We have a series of related tables: (simplified)

>[Address] 1 -> many [Person] 1->many [Subjects]

>On adding new records, I need to get the newly assigned ID (set by an
>identity column in SQL Server), so that the related records will also
>hold this same ID and therefore keep the data consistent.

>However, on inserting the record and then going back to it,

>....set fields in remote table to incoming values...
>rsRemote.Update
>rsRmote.MoveLast

>this creates an error (which took ages to find!) ...DAO thinks that
>the record has been deleted....

>What is the best way to go about getting this information back to the
>front-end?

>dirc Evans



Sat, 10 Mar 2001 03:00:00 GMT  
 Extracting information from a newly inserted record
rsRmote.Bookmark=rsRmote.LasModified

This also doesn't work!

Don't ask me why but... rather than implement an identity column, the
developer has written an ON INSERT  trigger that does exactly the
same.. ie increments the ID number.

I think that what is happening is that, since the record was changed
immediately following the update, DAO thinks the the last record it
holds is different to the one on the remote database.

I have a few work arounds in mind that work in a single user
situation, but would fall over if more than one record was being added
at a time.

Any ideas? I'm baffled!!!!



Quote:
>Try
>rsRmote.Bookmark=rsRmote.LasModified
>Best regards,



Mon, 12 Mar 2001 03:00:00 GMT  
 Extracting information from a newly inserted record
Then try to use:

on server side
Alex
Quote:

>rsRmote.Bookmark=rsRmote.LasModified

>This also doesn't work!

>Don't ask me why but... rather than implement an identity column, the
>developer has written an ON INSERT  trigger that does exactly the
>same.. ie increments the ID number.

>I think that what is happening is that, since the record was changed
>immediately following the update, DAO thinks the the last record it
>holds is different to the one on the remote database.

>I have a few work arounds in mind that work in a single user
>situation, but would fall over if more than one record was being added
>at a time.

>Any ideas? I'm baffled!!!!



>>Try
>>rsRmote.Bookmark=rsRmote.LasModified
>>Best regards,



Mon, 12 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. need ID from newly inserted record (altered by insert trigger on SQL server)

2. How to retrieve info from newly inserted record

3. Obtaining the value of the Identity column of a newly inserted record

4. How do I get the AutoNumber (or Identity) for a newly inserted record (from able-consulting)

5. Returning the primary key for a newly inserted record

6. AutoNumber of newly inserted RS

7. Getting the identity value of a newly inserted row

8. Getting IDENTITY value of newly inserted row

9. Identity cannot be determined for newly inserted rows

10. Error - The provider is unable to determine identity for newly inserted rows (0x80040E1B)

11. An error after clicking a newly inserted item of TreeView control

12. retrieving primary key of newly added record in ADO.NET

 

 
Powered by phpBB® Forum Software