Hello all,
This is probably easy, but I cannot figure it out.
I have this function in the module of a subform. The subform filters the data for a specific DetailID on the main form.
All works correctly except that it is returning 's' for all dates in the underlying table, not filtering for the handful of records showing in the subform.
Thanks in advance for your help!
MIB1019
This is probably easy, but I cannot figure it out.
I have this function in the module of a subform. The subform filters the data for a specific DetailID on the main form.
All works correctly except that it is returning 's' for all dates in the underlying table, not filtering for the handful of records showing in the subform.
Code:
Function WeeksToTextBox() As String 'returns string value of Air_Week dates in recordset, comma separated, formatted 'm/d'
Dim v As Variant
Dim s As String
'
With CurrentDb.OpenRecordset(Me.RecordSource, dbOpenSnapshot, dbReadOnly)
If Not (.BOF And .EOF) Then
.MoveFirst
While Not .EOF
v = .Fields("Air_Week").value
If Not IsNull(v) Then
v = CDate(v)
s = s & Format(v, "m/d") & ", "
End If
.MoveNext
Wend
End If
End With
If Len(s) > 0 Then s = Left(s, Len(s) - 2)
WeeksToTextBox = s
End Function
Thanks in advance for your help!
MIB1019