My Code works for the very first entry on the form and then stops, so I tried to loop throught the form but it is not working. I am missing something can anyone help thank you very much
my code is
Private Sub Form_Activate()
Dim mydate As Date
Dim myday As Date
Dim yestdate As Date
yestdate = Date - 1
myday = Text104
If WeekDay(myday) = 1 Then
mydate = Date
Else
If WeekDay(myday) = 7 Then
mydate = Date + 1
Else
mydate = yestdate
End If
End If
If mydate = (#8/5/02# Or #9/2/02# Or #10/14/02# Or #11/11/02# Or #12/25/02# Or #12/26/02#) Then
mydate = Date
End If
Dim fld As Field
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TRANSACTIONS", dbOpenDynaset)
For Each rst In Forms![Input]![TRANSACTION Subform]
If Text104.Value = yestdate Then
BiWeeklyDate.Value = mydate
End If
Next
my code is
Private Sub Form_Activate()
Dim mydate As Date
Dim myday As Date
Dim yestdate As Date
yestdate = Date - 1
myday = Text104
If WeekDay(myday) = 1 Then
mydate = Date
Else
If WeekDay(myday) = 7 Then
mydate = Date + 1
Else
mydate = yestdate
End If
End If
If mydate = (#8/5/02# Or #9/2/02# Or #10/14/02# Or #11/11/02# Or #12/25/02# Or #12/26/02#) Then
mydate = Date
End If
Dim fld As Field
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TRANSACTIONS", dbOpenDynaset)
For Each rst In Forms![Input]![TRANSACTION Subform]
If Text104.Value = yestdate Then
BiWeeklyDate.Value = mydate
End If
Next