SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Other Forums
 MS Access
 SQL - How can i INSERT INTO Auto populated increme
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

M4A
Starting Member

1 Posts

Posted - 06/21/2012 :  15:29:29  Show Profile  Reply with Quote
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.
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000