Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I loop through a bound control on a sub form

Status
Not open for further replies.

lizI3

Programmer
Jul 2, 2002
31
CA
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
 
What you may need to do is set it to single form and put the code in the OnCurrent event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top