Hello programmers,
I have a form frmform1 and inside is frmform2. frmform2 has 7 check boxes Monday - Sunday. If I select Monday then press a command button to open another form I would like the transfer of chk box monday's YES criteria to display on the newly opened form. This is what I have in VB:
Private Sub Form_Open(Cancel As Integer)
If Forms![frmform2].Form![Monday] = Yes Then
[Date2] = Date - Weekday(Date) + 2
End If
If Forms![frmform2].Form![Tuesday] = Yes Then
[Date2] = Date - Weekday(Date) + 3
End If
If Forms![frmform2].Form![Wednesday] = YES Then
[Date2] = Date - Weekday(Date) + 4
End If
If Forms![frmform2].Form![Thursday] = YES Then
[Date2] = Date - Weekday(Date) + 5
End If
If Forms![frmform2].Form![Friday] = YES
[Date2] = Date - Weekday(Date) + 6
End If
If Forms![frmform2].Form![Saturday] = YES
[Date2] = Date - Weekday(Date) + 7
End If
If Forms![frmform2].Form![Sunday] = YES
[Date2] = Date - Weekday(Date) + 8
End If
End Sub
The problem is:
The data transfers to the field but only the last if condition of Sunday. Eventhough I choose Monday or Tuesday, etc. How can I repair this function?
I have a form frmform1 and inside is frmform2. frmform2 has 7 check boxes Monday - Sunday. If I select Monday then press a command button to open another form I would like the transfer of chk box monday's YES criteria to display on the newly opened form. This is what I have in VB:
Private Sub Form_Open(Cancel As Integer)
If Forms![frmform2].Form![Monday] = Yes Then
[Date2] = Date - Weekday(Date) + 2
End If
If Forms![frmform2].Form![Tuesday] = Yes Then
[Date2] = Date - Weekday(Date) + 3
End If
If Forms![frmform2].Form![Wednesday] = YES Then
[Date2] = Date - Weekday(Date) + 4
End If
If Forms![frmform2].Form![Thursday] = YES Then
[Date2] = Date - Weekday(Date) + 5
End If
If Forms![frmform2].Form![Friday] = YES
[Date2] = Date - Weekday(Date) + 6
End If
If Forms![frmform2].Form![Saturday] = YES
[Date2] = Date - Weekday(Date) + 7
End If
If Forms![frmform2].Form![Sunday] = YES
[Date2] = Date - Weekday(Date) + 8
End If
End Sub
The problem is:
The data transfers to the field but only the last if condition of Sunday. Eventhough I choose Monday or Tuesday, etc. How can I repair this function?