Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 SQL - How can i INSERT INTO Auto populated increme

Author  Topic 

M4A
Starting Member

1 Post

Posted - 2012-06-21 : 15:29:29
Hi, i have a simple DB with 2 tables:
Table1.....ID|1st Lot No|No of Blocks|Part Number|Date|Lot Qty.

Table2.....ID|---------Lot No--------|Part Number|Date|Lot Qty.

What im trying to achieve is When the user inputs values in Table1, the data is pulled through to Table2, but i need the value in [Table2,Lot No] to auto increment Based on the Table1.No of blocks.

e.g. User inputs:

ID|1st Lot No|No of Blocks|Part Number|Date |Lot Qty.
1 | 62204 | 6 | TR456 |1/1/12|2.978KM

Then when Table1 Row_inserted, Table2 is auto updated to:

ID| Lot No|Part Number|Date |Lot Qty
1 |62204 | TR456 |1/1/12 |2.978KM
2 |62205 | TR456 |1/1/12 |2.978KM
3 |62206 | TR456 |1/1/12 |2.978KM
4 |62207 | TR456 |1/1/12 |2.978KM
5 |62208 | TR456 |1/1/12 |2.978KM
6 |62209 | TR456 |1/1/12 |2.978KM

I am using aspmaker and putting the code in the server event:
' Row Inserted event
Sub Row_Inserted(rsold, rsnew)

End Sub

I have been trying to achieve this using dims, insert into, i'v done numerouse tutorials and i just cant get it to work. My sql knowledge is moderate. But i'v been stuck on this for about 200hrs NO JOKE, i dont like giving up.
Please If anyone has the skills to show me the way, then i would greatly appreciate your help.
Regards, Mike.
   

- Advertisement -