[RESOLVED] breaking amout
Dear All,
Good Day,
I am using VB6, I have a Issue Breaking Amount in Chunk of 1,000,000/-
Case 1 - Suppose my amount is 1,500,000/- then it should break in 1st amount = 1,000,000/- & 2nd 500,000/-
Case 2 - Suppose my amount is 3,000,100/- then it should break in 1st amount = 1,000,000/- & 2nd 1000,000/- 3rd 1000,000/- & 4th 100/-
I have used function mode but it is working randomly!
Please assist
Thanks
Re: [RESOLVED] breaking amout
Code:
Const CHUNK = 1000000#
Dim temp_amount As Double, i As Long
temp_amount = Val(rsExcel("Amount"))
If temp_amount > CHUNK Then
For i = 1& To temp_amount \ CHUNK
Call InsertValues(CHUNK)
Next
End If
Call InsertValues(temp_amount Mod CHUNK)