Using an ampersand "&" and a plus "+" when concatenating do 2 separate things especially when there is a null involved.
I would probably simplify the book status Opt group code
Code:
Select Case fraBookStatus
Case 1 ' Borrowed books
varReturned = " AND [DateReturned] is null"
Case 2 ' Returned books
varReturned = " AND [DateReturned] is not null"
Case 3 ' All books borrowed and returned by a given member.
varReturned = ""
End Select
debug.print varReturned
Same with the dates
Code:
Select Case fraDates
Case 1 ' Date Borrowed
varDates = " Order by DateBorrowed "
Case 2 ' Date Due
varDates = " Order by DateDue "
Case 3 ' Date Returned
varDates = " Order by DateReturned "
End Select
If this applies to a subform, I may be more inclined to use a filter.