Hi, thank in advance for your help, I am trying to make a access program to keep track of the money in the Till. I am thinking of storing the number of 20' , 10' , 5' to 0.01 in the till in a table, and once the total of the change is calculated, check to see if there are any 20' in table field that holds the number of 20' etc. and tell the end user to give customer for exp if change was 35 to output give: 1 20, 1 10 and 1 5. I am new to access but have programmed before using flash actionscript. The programming is not the problem I am having but how to go about doing this. The first thing that came to mind was using if statement, but that wouls be alot of if' is there a way I can use some kind loop to handle this, and what kind loop would be best for this. here is a example of what I have in mind.
variable
dim the_change
dim div_amount
dim div_result
dim outputrslt
in the on click event of a button
the_change = the_changetxt.text
do while the_change > 0
if the_change >20 then
div_amount = 20
div_result = the_change / div_amout ' This will give the number of 20's in the change
elseif
....... ' the same thing for untill 0.01
end if
do while div_result >= 1
if chngtble(div_amount) > 1 then ' dont really know if this will work chngtble is the names of the fields that hold the number of 20' , 10' etc in the Till so the name would be like chngtbl20, chngtbl10 etc
chngtble(div_amount) = chngtble(div_amount) - 1
div_result = div_result -1
outputrslt = outputrslt + 1
else
changetxt(div_amount).text = outputrslt
exit do
end if
Loop
loop
Is there easier way then this to do this, I cant think of a way to end the first loop, it should end, but for some reason on some tests I did it doesnt?
what are your thoughts on this, I am sure there is a better way to do this and it have been done before.
thanks in advance
variable
dim the_change
dim div_amount
dim div_result
dim outputrslt
in the on click event of a button
the_change = the_changetxt.text
do while the_change > 0
if the_change >20 then
div_amount = 20
div_result = the_change / div_amout ' This will give the number of 20's in the change
elseif
....... ' the same thing for untill 0.01
end if
do while div_result >= 1
if chngtble(div_amount) > 1 then ' dont really know if this will work chngtble is the names of the fields that hold the number of 20' , 10' etc in the Till so the name would be like chngtbl20, chngtbl10 etc
chngtble(div_amount) = chngtble(div_amount) - 1
div_result = div_result -1
outputrslt = outputrslt + 1
else
changetxt(div_amount).text = outputrslt
exit do
end if
Loop
loop
Is there easier way then this to do this, I cant think of a way to end the first loop, it should end, but for some reason on some tests I did it doesnt?
what are your thoughts on this, I am sure there is a better way to do this and it have been done before.
thanks in advance