Filter not working (AND)

David Ball

Registered User.
Local time
Today, 19:34
Joined
Aug 9, 2010
Messages
230
Hi,

I have a report that I am trying to filter with VBA code.

After running the code I get the following in the Property Sheet, Data, Filter row:

[Project] IN('KLE323 Piperacks EC Project') AND [Reporting Week Ending] IN(#2/06/2017#)

The report is not working and always stays blank with no records. If I manually modify the string to just [Project] IN('KLE323 Piperacks EC Project') the report opens correctly. If I manually adjust it to just [Reporting Week Ending] IN(#2/06/2017#) the report also opens correctly.

I have double checked that there are records that meet both these criteria.

Is there something wrong with the way I am expressing the "AND"?

Thanks very much

Dave
 
Actually, when I adjust it to I manually adjust it to just [Reporting Week Ending] IN(#2/06/2017#) the report does not work properly. The report opens with data in it but it is not filtered to just 02/06/2017, it shows all dates.

Looks like there is something wrong with my date format? Any ideas?
 
Date format should be mm/dd/yyyy
 
Found the problem. I had to format the date to the ridiculous American date format.

For Each varItem In Me.lsbWEdate.ItemsSelected
strWEdate = strWEdate & ",#" & Format(Me.lsbWEdate.ItemData(varItem) _
, "mm\/dd\/yyyy") & "#"
 
See where that constant for date format starts to come in handy? :)

Found the problem. I had to format the date to the ridiculous American date format.

For Each varItem In Me.lsbWEdate.ItemsSelected
strWEdate = strWEdate & ",#" & Format(Me.lsbWEdate.ItemData(varItem) _
, "mm\/dd\/yyyy") & "#"
 

Users who are viewing this thread

Back
Top Bottom