Everything is possible. It sounds like you would need a few IF statements. It might be easier to set a variable above the insert code to get the value you want updated. If you attach the page you are working on I could take a look and give you sample code. It is a bit too complex to talk about generally and expect you to implement it.