try this:
sql = "set nocount on insert into products (CustomerId) values ('" & iCustNo & "') select @@identity set nocount off"
rs.open sql
msgbox rs(0)
>I want to insert a record into an Access table using:
>
>
>"insert into products (CustomerId) values ('" & iCustNo & "')"
>>
>Then I want to add order detail items. For this I need to new
>auto-generated Id from the Access table.
>
>After the insert above, there could be many records for the customer,
>so how do I know the Id of the new record?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com