Since I'm not clear on what exactly makes a payment schedule, I have copied your sample data into a table called VAUser.
Below is a vba procedure to append a record to your table. The new record would be for the next Payment, and includes the new Payment Date and new Payment Number.
Code:
'---------------------------------------------------------------------------------------
' Procedure : vaPay
' Author : mellon
' Date : 26/02/2015
' Purpose :
'based on https://www.accessforums.net/database-design/need-help-using-access-create-payment-schedule-50611.html
'
' This routine reads the last record in the table, and gets values for adding a new record.
' It saves the field values in temp variables. Then prepares to add a new record (AddNew)
' assigns values to the fields
'Note: It adds 2 weeks to the latest Payment Date; 1 to the latest Payment Number
'
'It is set up to add only 1 record
'
'---------------------------------------------------------------------------------------
'
Sub vaPay()
' VaUser ( EmplId, [Employee Name], [Payment Date], [Payment Number], [Payment Amount] )
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim EmpId As Long
Dim EmpName As String
Dim PayAmt As Double
Dim PayNo As Long
Dim PayLast As Date
Dim i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("VaUser")
i = 0
rs.MoveLast ' to get the latest values in the Employee record
EmpId = rs!EmplId 'same emplId
EmpName = rs![Employee name] 'employee name
PayLast = rs![payment Date] 'last Payment date
PayNo = rs![Payment Number] 'last payment number
PayAmt = rs![Payment Amount] 'last payment amount
'do stuff here
Do While Not rs.EOF And i = 0
rs.AddNew ' set up to add a new record
rs!EmplId = EmpId
rs![Employee name] = EmpName
rs![payment Date] = DateAdd("ww", 2, PayLast) 'add 2 weeks to the latest Pay Date
rs![Payment Amount] = PayAmt
rs![Payment Number] = PayNo + 1 'add 1 to the latest Pay Number
'print the values to be added to ensure proper values
Debug.Print rs!EmplId; rs![Employee name]; rs![payment Date]; rs![Payment Amount]; rs![Payment Number]
rs.Update 'update the table with a new record
i = i + 1 'stop the process since i is no longer = 0
Loop
End Sub
Table after adding the new record
NOTE: ID is an autonumber PK I added to the table when importing the data.
Code:
EmplId |
Employee Name |
Payment Date |
Payment Number |
ID |
Payment Amount |
12345 |
John Doe |
16/01/2015 |
1 |
2 |
1352.16 |
12345 |
John Doe |
30/01/2015 |
2 |
3 |
4507.2 |
12345 |
John Doe |
13/02/2015 |
3 |
4 |
4507.2 |
12345 |
John Doe |
27/02/2015 |
4 |
5 |
4507.2 |
12345 |
John Doe |
13/03/2015 |
5 |
6 |
4507.2 |
12345 |
John Doe |
27/03/2015 |
6 |
17 |
4507.2 |
Hope this is helpful.