I have a very simple example here I have a table with two fields ID(Autonumber) MyNumber Number Field.
Now I have prepared a simple report using my Table and I have placed an unbound list box to show my the results of my subtractions. The code is as below
Code:
Private Sub Report_Load()
Dim intMyNumber As Double
Dim strMyString As String
intMyNumber = Me.myNumber
Do While intMyNumber > 0
intMyNumber = intMyNumber - 0.016
'I have added this part to show only positive results.
If intMyNumber < 0 Then
Exit Do
Else
If Len(strMyString) > 0 Then
strMyString = strMyString & ";" & Format(intMyNumber, "0.000")
Else
strMyString = Format(intMyNumber, "0.000")
End If
End If
Loop
Me.List2.RowSource = strMyString
End Sub
The code is attached to the onLoad Event. Refer to Screen Shot Attached.