C
corics15 via AccessMonster.com
hello again! i have this piece of code which when executed deletes the last
record. i can't seem to figure it out as to why this is happening.
here's the table BEFORE execution of the below code.
Period Due Date Payment Due Balance
1 6/15/2008 1,026.67 11,293.33
2 6/30/2008 1,026.67 10,266.66
3 7/15/2008 1,026.67 9,239.99
4 7/31/2008 1,026.67 8,213.32
5 8/15/2008 1,026.67 7,186.65
6 8/31/2008 1,026.67 6,159.98
7 9/15/2008 1,026.67 5,133.31
8 9/30/2008 1,026.67 4,106.64
9 10/15/2008 1,026.67 3,079.97
10 10/31/2008 1,026.67 2,053.30
11 11/15/2008 1,026.67 1,026.63
12 11/30/2008 1,026.67 0.00
here's the table AFTER execution of the below code.
Period Due Date Payment Due Balance
1 6/15/2008 1,026.67 11,293.33
2 6/30/2008 1,026.67 10,266.66
3 7/15/2008 1,026.67 9,239.99
4 7/31/2008 1,026.67 8,213.32
5 8/15/2008 1,026.67 7,186.65
6 8/31/2008 1,026.67 6,159.98
7 9/15/2008 1,026.67 5,133.31
8 9/30/2008 1,026.67 4,106.64
9 10/15/2008 1,026.67 3,079.97
10 10/31/2008 1,026.67 2,053.30
11 11/15/2008 1,026.67 1,026.63
this code uses the .EDIT method, assuming i want to change the value of the
loaned amount, data should also change, but i have noticed that the last
record is being deleted. any help would be greatly appreciated.
If editFlag = True Then
rst.MoveLast '
populate recordset
rst.MoveFirst '
populate recordset
rst.FindFirst (memberID)
With rst
For I = start_date To end_date
If Day(I) = 15 Or Day(DateAdd("d", 1, I)) = 1 Then ' 15th or
last day of month
counter = counter + 1 ' let us
increment our counter!
.Edit ' edit or
update member records
![due_date] = I
![period] = counter
![payment_due] = Round(Form_frmMain.txtSemiMonthlyPmt, 2)
If counter = 1 Then
![balance] = Form_frmMain.txtTotal - ![payment_due]
Else
![balance] = Form_frmMain.txtTotal - (![payment_due] *
counter)
End If
![MemID] = Form_frmMain.txtMNo
.Update
.MoveNext
If .EOF Then .MoveLast
End If
Next I
End With
Else
record. i can't seem to figure it out as to why this is happening.
here's the table BEFORE execution of the below code.
Period Due Date Payment Due Balance
1 6/15/2008 1,026.67 11,293.33
2 6/30/2008 1,026.67 10,266.66
3 7/15/2008 1,026.67 9,239.99
4 7/31/2008 1,026.67 8,213.32
5 8/15/2008 1,026.67 7,186.65
6 8/31/2008 1,026.67 6,159.98
7 9/15/2008 1,026.67 5,133.31
8 9/30/2008 1,026.67 4,106.64
9 10/15/2008 1,026.67 3,079.97
10 10/31/2008 1,026.67 2,053.30
11 11/15/2008 1,026.67 1,026.63
12 11/30/2008 1,026.67 0.00
here's the table AFTER execution of the below code.
Period Due Date Payment Due Balance
1 6/15/2008 1,026.67 11,293.33
2 6/30/2008 1,026.67 10,266.66
3 7/15/2008 1,026.67 9,239.99
4 7/31/2008 1,026.67 8,213.32
5 8/15/2008 1,026.67 7,186.65
6 8/31/2008 1,026.67 6,159.98
7 9/15/2008 1,026.67 5,133.31
8 9/30/2008 1,026.67 4,106.64
9 10/15/2008 1,026.67 3,079.97
10 10/31/2008 1,026.67 2,053.30
11 11/15/2008 1,026.67 1,026.63
this code uses the .EDIT method, assuming i want to change the value of the
loaned amount, data should also change, but i have noticed that the last
record is being deleted. any help would be greatly appreciated.
If editFlag = True Then
rst.MoveLast '
populate recordset
rst.MoveFirst '
populate recordset
rst.FindFirst (memberID)
With rst
For I = start_date To end_date
If Day(I) = 15 Or Day(DateAdd("d", 1, I)) = 1 Then ' 15th or
last day of month
counter = counter + 1 ' let us
increment our counter!
.Edit ' edit or
update member records
![due_date] = I
![period] = counter
![payment_due] = Round(Form_frmMain.txtSemiMonthlyPmt, 2)
If counter = 1 Then
![balance] = Form_frmMain.txtTotal - ![payment_due]
Else
![balance] = Form_frmMain.txtTotal - (![payment_due] *
counter)
End If
![MemID] = Form_frmMain.txtMNo
.Update
.MoveNext
If .EOF Then .MoveLast
End If
Next I
End With
Else