I have a list box of items in which the user can set up to 10 different tracking dates for each list item. The user can select one or any combination of items in the list box (multiple select), then click on one or several text boxes and enter a date. The date(s) will then be saved to a database. If one of the items selected has already been "dated and saved" and the user enters a different date, a form displays with all of the existing dates that differ from the new date. The user has the option through the use of check boxes to either overwrite the existing date (Yes check box) or not to overwrite the existing date (No check box). The code cycles through each date field looking for any dates that differ. As long as the user checks Yes on the displayed form, the code will return to the original loop and go to the next iteration. If the user checks No it will not go back to the original loop. My code is as follows:

Original loop:
Public Sub CheckIssueDates()

Dim intSelected, intSelCount, I, J As Integer
Dim strAccQuery As String

intSelected = lstAllLines.ListCount
intSelCount = 0
For I = 0 To intSelected - 1
If lstAllLines.Selected(I) Then
intSelCount = intSelCount + 1
strAccQuery = "SELECT * FROM IssueTypes WHERE LineNumber = '" _
& lstAllLines.List(I) & "'"
DB.OpenDB strAccQuery
NullField.Value = DB.recRecordset("ToPipingCheck")
arrDates(0) = NullField.IsNull
NullField.Value = DB.recRecordset("FromPipingCheck")
arrDates(1) = NullField.IsNull
NullField.Value = DB.recRecordset("ToStress")
arrDates(2) = NullField.IsNull
NullField.Value = DB.recRecordset("FromStress")
arrDates(3) = NullField.IsNull
NullField.Value = DB.recRecordset("ToMTO")
arrDates(4) = NullField.IsNull
NullField.Value = DB.recRecordset("FromMTO")
arrDates(5) = NullField.IsNull
NullField.Value = DB.recRecordset("Hold")
arrDates(6) = NullField.IsNull
NullField.Value = DB.recRecordset("IFC")
arrDates(7) = NullField.IsNull
NullField.Value = DB.recRecordset("TransDate")
arrDates(8) = NullField.IsNull
NullField.Value = DB.recRecordset("IssueRelDate")
arrDates(9) = NullField.IsNull
DB.CloseDB
For J = 0 To 9
If arrDates(J) = "" Then
If txtDates(J).Text <> "" Then
DB.OpenDB strAccQuery
DB.SaveThisIssueDate J
DB.CloseDB
End If
End If
If arrDates(J) <> "" Then
If txtDates(J).Text <> "" And txtDates(J).Text <> _
arrDates(J) Then
frmDistDates.lblExistDates(J).Caption = arrDates(J)
frmDistDates.lblLineNo.Caption = lstAllLines.List(I)
frmDistDates.chkNo(J).Value = 1
frmDistDates.Visible = True
End If
End If
Next J
End If
Next I

End Sub

Loop behind "DistDates" form:

Private Sub cmdOK_Click()

Dim I As Integer
Dim strAccQuery As String

strAccQuery = "SELECT * FROM IssueTypes WHERE LineNumber = '" _
& lblLineNo & "'"

For I = 0 To 9
If lblExistDates(I).Caption <> "" And chkYes(I).Value = 1 Then
DB.OpenDB strAccQuery
DB.SaveThisIssueDate I
DB.CloseDB
ElseIf lblExistDates(I).Caption <> "" And chkNo(I).Value = 1 Then
frmDistDates.Visible = False
End If
Next I
For I = 0 To 9
lblExistDates(I).Caption = ""
chkYes(I).Value = 0
chkNo(I).Value = 0
Next I
frmDistDates.Visible = False
frmStatusNotArea.CheckIssueDates

End Sub

I feel like I'm missing something very basic and simple but can't get it to work properly. Any ideas?

[Edited by mgoarrow on 11-15-2000 at 02:37 PM]