A
Azza
'===================================================================
'Checks if the complee date fied has been completed
'===================================================================
Dim vDateComplete1 As Long
vDateComplete1 = 0
If cboxDay1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If cboxMonth1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If cboxYear1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If vDateComplete1 = 1 Or vDateComplete1 = 2 Then
MsgBox "Please complete the date field"
cboxDay1.SetFocus
Exit Sub
End If
Dim vDateComplete2 As Long
vDateComplete2 = 0
If cboxDay2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If cboxMonth2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If cboxYear2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If vDateComplete2 = 1 Or vDateComplete2 = 2 Then
MsgBox "Please complete the date field"
cboxDay2.SetFocus
Exit Sub
End If
...... (15 times)
How do I variablise this using "For...Next"???
It checks 15 sets of 3 date boxes to make sure each is complete or
totally empty - it works, but I would like to condense the code ..
Problem: I do not know how to code cboxMonth(i) .. cboxYear(i) ...
etc, to cycle through 1-15??
Please help
'Checks if the complee date fied has been completed
'===================================================================
Dim vDateComplete1 As Long
vDateComplete1 = 0
If cboxDay1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If cboxMonth1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If cboxYear1 <> "" Then
vDateComplete1 = vDateComplete1 + 1
End If
If vDateComplete1 = 1 Or vDateComplete1 = 2 Then
MsgBox "Please complete the date field"
cboxDay1.SetFocus
Exit Sub
End If
Dim vDateComplete2 As Long
vDateComplete2 = 0
If cboxDay2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If cboxMonth2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If cboxYear2 <> "" Then
vDateComplete2 = vDateComplete2 + 1
End If
If vDateComplete2 = 1 Or vDateComplete2 = 2 Then
MsgBox "Please complete the date field"
cboxDay2.SetFocus
Exit Sub
End If
...... (15 times)
How do I variablise this using "For...Next"???
It checks 15 sets of 3 date boxes to make sure each is complete or
totally empty - it works, but I would like to condense the code ..
Problem: I do not know how to code cboxMonth(i) .. cboxYear(i) ...
etc, to cycle through 1-15??
Please help