AutoNumber of newly inserted RS 
Author Message
 AutoNumber of newly inserted RS

i am inserting a new recordset into a db table (ms access btw).  the
tables primary key is an autonumber field.  is there an easy way to know
the number of the newly inserted record?

i am using DAO with VB6 and Access2000

thanks

--
Posted via CNET Help.com
http://www.*-*-*.com/



Tue, 08 Oct 2002 03:00:00 GMT  
 AutoNumber of newly inserted RS
Yes there is, after you complete the edit, the key field will contain the
created autonumber:

    rs.addnew
    rs!Field = "Value"
    rs!Field = "Value"
    rs.update
    autonumber = rs!PrimaryKey

it sure beats having to use the last modified bookmark and re-reading the
row.


Quote:
> i am inserting a new recordset into a db table (ms access btw).  the
> tables primary key is an autonumber field.  is there an easy way to know
> the number of the newly inserted record?

> i am using DAO with VB6 and Access2000

> thanks

> --
> Posted via CNET Help.com
> http://www.help.com/



Tue, 08 Oct 2002 03:00:00 GMT  
 AutoNumber of newly inserted RS
thanks for the help...

Quote:

> Yes there is, after you complete the edit, the key field will contain the
> created autonumber:

>     rs.addnew
>     rs!Field = "Value"
>     rs!Field = "Value"
>     rs.update
>     autonumber = rs!PrimaryKey

> it sure beats having to use the last modified bookmark and re-reading the
> row.



> > i am inserting a new recordset into a db table (ms access btw).  the
> > tables primary key is an autonumber field.  is there an easy way to
know
> > the number of the newly inserted record?

> > i am using DAO with VB6 and Access2000

> > thanks

> > --
> > Posted via CNET Help.com
> > http://www.help.com/

--
Posted via CNET Help.com
http://www.help.com/


Tue, 08 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

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

3. Extracting information from a newly inserted record

4. How to retrieve info from newly inserted record

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

6. Getting the identity value of a newly inserted row

7. Getting IDENTITY value of newly inserted row

8. Identity cannot be determined for newly inserted rows

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

10. Returning the primary key for a newly inserted record

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

12. rs.Addnew or INSERT INTO

 

 
Powered by phpBB® Forum Software