D
DS
This Loop only updates the records to the first value. On 3.52 / 5 it
should update each record as such...
..71
..71
..70
..70
..70
but it's doing all .71
I think perhaps it's a timing issue?
Thanks
DS
Private Sub Command0_Click()
Dim myNums As String
Dim myNumDivByX As Currency
Dim portion(100) As Currency
Dim i As Currency
Dim leftover As Currency
Dim absleftover As Currency
Dim addon As Currency
myNumDivByX = Round(Me.TxtmyNum / Me.TxtX, 2)
leftover = Me.TxtmyNum - (myNumDivByX * Me.TxtX)
absleftover = Abs(leftover)
If leftover < 0 Then
addon = -0.01
Else
addon = 0.01
End If
For i = 1 To Me.TxtX
If i <= absleftover * 100 Then
portion(i) = myNumDivByX + addon
Else
portion(i) = myNumDivByX
End If
myNums = myNums & portion(i) & vbCrLf
Me.TxtNew = myNums
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM tblTSC WHERE
tblTSC.OldCheckID = " & Forms!Form3!TxtCheckID & "", dbOpenDynaset)
With rst
Do Until .EOF
.Edit
!ChkTotal = Me.TxtNew
.Update
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
Next i
End Sub
should update each record as such...
..71
..71
..70
..70
..70
but it's doing all .71
I think perhaps it's a timing issue?
Thanks
DS
Private Sub Command0_Click()
Dim myNums As String
Dim myNumDivByX As Currency
Dim portion(100) As Currency
Dim i As Currency
Dim leftover As Currency
Dim absleftover As Currency
Dim addon As Currency
myNumDivByX = Round(Me.TxtmyNum / Me.TxtX, 2)
leftover = Me.TxtmyNum - (myNumDivByX * Me.TxtX)
absleftover = Abs(leftover)
If leftover < 0 Then
addon = -0.01
Else
addon = 0.01
End If
For i = 1 To Me.TxtX
If i <= absleftover * 100 Then
portion(i) = myNumDivByX + addon
Else
portion(i) = myNumDivByX
End If
myNums = myNums & portion(i) & vbCrLf
Me.TxtNew = myNums
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM tblTSC WHERE
tblTSC.OldCheckID = " & Forms!Form3!TxtCheckID & "", dbOpenDynaset)
With rst
Do Until .EOF
.Edit
!ChkTotal = Me.TxtNew
.Update
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
Next i
End Sub