Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with querying for a date

Status
Not open for further replies.

mvital

Technical User
Jul 2, 2003
128
US
I have the following code. I am wanting to filter a report for a date or dates the user selects. I know I am missing the #. I always have trouble with the date fields. Where would they go. Right now the code treats the field as a string.


For Each varItem In Me.lstDate.ItemsSelected
strDate = strDate & ",'" & Me.lstDate.ItemData(varItem) _
& "'"
Next varItem
If Len(strDate) = 0 Then
strDate = "Like '*'"
Else
strDate = Right(strDate, Len(strDate) - 1)
strDate = "IN(" & strDate & ")"
End If

Any help would be appreciated.

MV
 
A starting point:
strDate = strDate & ",#" & Me!lstDate.ItemData(varItem) _
& "#"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top