G
Guest
I have a table I am trying to update using a form. The table has several
fields a few are ServDate (the date a service is provided) ConEndDate (this
is the contract end date) and the frequency that the service is to be
provided (weekly, fortnightly etc). When I have entered the first record i.e.
ContractNo,ServiceDate,StartTime, EndTime and Employee, I would then like it
to update the table with all the shifts based on the information using a
button to update the table.
I have an append query which I would like to run until the contract End date
is reached. I have tried everything, but I can't get the form to refresh
every time a new record is created in the table therefore the loop doesn't
end.The code I am using is:
Private Sub repeat_Click()
Dim dbs As DAO.Database
Dim StDocName As String
Set dbs = CurrentDb()
StDocName = "qryServDate"
Do While Me.ServDate <= Me.ConEndDate
DoCmd.OpenQuery StDocName, acNormal, acEdit
Me.Refresh
If Me.ServDate >= Me.ConEndDate Then Exit Do
Loop
End Sub
Can someone please help me. I am going nuts trying to work this out.
fields a few are ServDate (the date a service is provided) ConEndDate (this
is the contract end date) and the frequency that the service is to be
provided (weekly, fortnightly etc). When I have entered the first record i.e.
ContractNo,ServiceDate,StartTime, EndTime and Employee, I would then like it
to update the table with all the shifts based on the information using a
button to update the table.
I have an append query which I would like to run until the contract End date
is reached. I have tried everything, but I can't get the form to refresh
every time a new record is created in the table therefore the loop doesn't
end.The code I am using is:
Private Sub repeat_Click()
Dim dbs As DAO.Database
Dim StDocName As String
Set dbs = CurrentDb()
StDocName = "qryServDate"
Do While Me.ServDate <= Me.ConEndDate
DoCmd.OpenQuery StDocName, acNormal, acEdit
Me.Refresh
If Me.ServDate >= Me.ConEndDate Then Exit Do
Loop
End Sub
Can someone please help me. I am going nuts trying to work this out.