Pricing Uplift

D

David M C

I have a table with fields SORCode (text) and Price (currency). I have added
two fields KCode and KPrice. I would like the field KCode to be the SORCode
appended with "KTF" and the field KPrice to be Price * 2.

How would I be able to programatically cycle all the records and update the
KCode and KPrice fields?

Is it possible to do this with a query?

Thanks

Dave
 
K

Klatuu

Alex's code will do that; however, you probably should not. That is
essentially storing calculated fields which is frowned upon for good database
design. If you know that KCode will always be SORCode with KTF appended, the
place to do that is where the user would see it, not in the table. As to the
price, If a user changes a price in the table, then your KPrice will be
incorrect. Again, when you need to use the KPrice, calculate it, but don't
store it in the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top