Cardbox Talk


CardboxForumsCardbox Talk > "Increase of Field Value"

Increase of Field Value

Can I increase the values of a particular field across my whole record collection

Posted By Post


14-Oct-2014 16:04

I want to implement a price increase on my database, Is there a way in which I can increase all the values of a particular field so reflect this...? I want to increase the value of a particular field by 10% for example... please help!


14-Oct-2014 18:07

A macro...!
This one will update all records in the selection, starting from the current record.
This is not the most fast macro - but if will work

'loop for all records of your selection
For rec = RecordPosition to Records.Count
'make object of the current record
set arec = ActiveRecord
'edit the current record
'increase the number in that field
arec.Fields("YOURFIELDNAME") = 1.1*NumberFromCardbox(arec.Fields("YOURFIELDNAME"))
'save the record
'goto nextrecord
'end of the loop

Please first test on one record. Your Windows-Language-Settings can bother you with this.
Also: if you need b.e. always two decimals, you need additional code for this.
I hope this helps you.


15-Oct-2014 12:41

Thanks Bert, as ever very useful....
I am still such a novice at this however.....

If I wanted to perform the above operation and save the results in a newly created field - whilst retaining the data in the original field in its original place - how would i amend the above code?
And is there a way of retaining the price format - ie: when I performed the above, £10.00 was increased to £11 but didnt retain the .00 if you get what i mean...!!

Also is there anyone you can recommend on this forum who would be able to give us some freelance support on writing macros and syncing with xcel?

Kind Regards



15-Oct-2014 17:15

I did warn you (decimals).
Your question about freelanceg mail me private at cardbox@outlook.com

© 2010 Cardbox Software Limited   Home