Hey I have been looking through the forums, but I have not found my specific code.
What I am trying to do is based on a length of time, say 24 weeks, I want a table to be populated with a count of 24 weeks, but this count will start at week 9. So it would count week 9 through week 33. And then also, I am trying to attach a salary to this code in another column. This is my code:
Private Sub Command45_Click()
Dim WkStart As Integer
Dim WkEnd As Integer
Dim GrSalary As Currency
Dim rsReser As DAO.Recordset
On Error GoTo Err_Command45_Click
CurrentDb.Execute "Delete * from TBL_SALARY"
Set rsReser = CurrentDb.OpenRecordset("TBL_SALARY", dbOpenDynaset, dbSeeChanges)
WkStart = "9"
WkEnd = Forms!frm_Main.Text2 + 9
Do While WkStart <= WkEnd
rsReser.AddNew
rsReser("Week") = WkStart
rsReser("Salary") = GrSalary
rsReser.Update
WkStart = DCount(1, WkStart)
GrSalary = Forms!frmMain.Text9
Loop
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click
End Sub
Thanks!!
What I am trying to do is based on a length of time, say 24 weeks, I want a table to be populated with a count of 24 weeks, but this count will start at week 9. So it would count week 9 through week 33. And then also, I am trying to attach a salary to this code in another column. This is my code:
Private Sub Command45_Click()
Dim WkStart As Integer
Dim WkEnd As Integer
Dim GrSalary As Currency
Dim rsReser As DAO.Recordset
On Error GoTo Err_Command45_Click
CurrentDb.Execute "Delete * from TBL_SALARY"
Set rsReser = CurrentDb.OpenRecordset("TBL_SALARY", dbOpenDynaset, dbSeeChanges)
WkStart = "9"
WkEnd = Forms!frm_Main.Text2 + 9
Do While WkStart <= WkEnd
rsReser.AddNew
rsReser("Week") = WkStart
rsReser("Salary") = GrSalary
rsReser.Update
WkStart = DCount(1, WkStart)
GrSalary = Forms!frmMain.Text9
Loop
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click
End Sub
Thanks!!