Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

DASL to filter mails received in a specific day

Writer Sophia Terry

I would like to use a DASL filter to filter mails received in a specific day.

filterstring = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%" & subject & "%'" & _ " AND ""urn:schemas:httpmail:datereceived"" LIKE '%" & received_date & "%'" & _ " AND ""urn:schemas:httpmail:datereceived"" LIKE '%" & received_date_plus & "%'"

The variables are previously defined. "received_date_plus" is the received date plus one day.

0

1 Answer

The LIKE operator is used for string properties. You need to use < and > to compare date time values (and never use equality operators). Read more about that in the Filtering Items Using a Date-time Comparison article.

filterstring = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%" & subject & "%'" & _ " AND ""urn:schemas:httpmail:datereceived"" > '" & Format(received_date ,"General Date")& "' & _ " AND ""urn:schemas:httpmail:datereceived"" < '" & Format(received_date_plus, "General Date") & "'"

Pay attention to the fact that dates should be formatted like Outlook expects them. So, it makes sense to use the Format function available in VBA.

Also you may find the following articles helpful:

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.