Hi June7!
Perhaps you can give me a little help with this other dialog. Sometimes the user has to plot his details weekly rather than daily. If that's the case on the calling subform, the code opens a different dialog box that's got some other detail. I've got it working correctly, filling the listbox with Week Start Dates; but the the 'selecting' of those "Air_Weeks" that range of dates is not working. I can see that the Air_Date records exist in the table, but aren't selected.
Here is the code. Inserting some debugging into it, I see that the Dlookup function is returning Nulls on the Air_Weeks of the table. Must be the string value of .itemdata(x) causing this.
Code:
'populate the date list box 'determine week start of txtstartdate
'Clear ListboxFirst
Call ClearListBox
Dim ListStart, ListEnd As Date
ListStart = Me.txtStart
ListEnd = Me.txtEnd
Dim FirstWkStart
Dim LastWkStart
FirstWkStart = ListStart - Weekday(ListStart, 2) + 1
LastWkStart = ListEnd - Weekday(ListEnd, 2) + 1
Dim iWeeks, i, varDate
iWeeks = DateDiff("w", FirstWkStart, LastWkStart)
Debug.Print FirstWkStart
Debug.Print LastWkStart
Debug.Print iWeeks
For i = 0 To iWeeks
varDate = DateAdd("ww", i, CDate(FirstWkStart))
Me.lstSelectDates.AddItem Format(varDate, "mm/dd/yy")
Next
'Show Weeks that exist in tblIODetails_Dates as Selected
Dim x As Integer
With Me.lstSelectDates
For x = 0 To .ListCount - 1
If Not IsNull(DLookup("Air_Week", "tblIODetails_Dates", "Detail_ID =" & Me.txtDetailID & " AND Air_Week = #" & .ItemData(x) & "#")) Then .Selected(x) = True
Next
End With
Again, I really appreciate the help!