E
emanson
Hello! I am trying to set up a filter where I can restrict retrieved messages
from an Outlook 98 account using the ReceivedTime, Restrict method, and a
dynamically assigned date range:
Set myItms = objFolder.Items
DateFrom = Format(DateFrom, "ddddd h:nn AMPM")
DateTo = Format(DateTo, "ddddd h:nn AMPM")
sFilterFrom = "[ReceivedTime] >= " & Chr(34) & Format(DateFrom, "mmm, dd
yyyy") & " 12:00 AM " & Chr(34)
sFilterTo = "[ReceivedTime] < " & Chr(34) & Format(DateTo, "mmm, dd yyyy") &
" 12:00 AM" & Chr(34)
' DNW sFilterFrom = "[ReceivedTime] >= " & Chr(34) &
Format(DateFrom, "mm/dd/yyyy") & Chr(34)
' DNW sFilterTo = "[ReceivedTime] < " & Chr(34) & Format(DateTo,
"mm/dd/yyyy") & Chr(34)
sFilter = sFilterFrom & " AND " & sFilterTo
' MsgBox (sFilter)
Set myItms = myItms.Restrict(sFilter)
'>>>>>>>>>>>>>>>> Restrict does not work
'myItms.SetColumns ("BillingInformation")
' myItms.SetColumns ("[ReceivedTime],[BillingInformation]")
' myItms.Sort "BillingInformation", False
If myItms.count > 0 Then
For Each itm In myItms
If itm.Unread = True Then
'On Error Resume Next
ReceivedTime = itm.ReceivedTime
If ReceivedTime <= DateAdd("m", -1, Now) Then
MsgBox ("Problem.....")
End If
Todays Date is 9/29/2005.
I am using a DateFrom value of 9/1/2005 and a DateTo value of 10/1/2005. I
have the On Error Resume Next statment commented out.
SFilter becomes:
sFilter = [ReceivedTime] >= "Sep, 01 2005 12:00 AM" AND [ReceivedTime] <
"Sep, 20 2005 12:00 AM"
This does not throw an error but also does not filter out messages that do
not meet the sFilter condition. What am I doing wrong?
Thanks so much for your help
from an Outlook 98 account using the ReceivedTime, Restrict method, and a
dynamically assigned date range:
Set myItms = objFolder.Items
DateFrom = Format(DateFrom, "ddddd h:nn AMPM")
DateTo = Format(DateTo, "ddddd h:nn AMPM")
sFilterFrom = "[ReceivedTime] >= " & Chr(34) & Format(DateFrom, "mmm, dd
yyyy") & " 12:00 AM " & Chr(34)
sFilterTo = "[ReceivedTime] < " & Chr(34) & Format(DateTo, "mmm, dd yyyy") &
" 12:00 AM" & Chr(34)
' DNW sFilterFrom = "[ReceivedTime] >= " & Chr(34) &
Format(DateFrom, "mm/dd/yyyy") & Chr(34)
' DNW sFilterTo = "[ReceivedTime] < " & Chr(34) & Format(DateTo,
"mm/dd/yyyy") & Chr(34)
sFilter = sFilterFrom & " AND " & sFilterTo
' MsgBox (sFilter)
Set myItms = myItms.Restrict(sFilter)
'>>>>>>>>>>>>>>>> Restrict does not work
'myItms.SetColumns ("BillingInformation")
' myItms.SetColumns ("[ReceivedTime],[BillingInformation]")
' myItms.Sort "BillingInformation", False
If myItms.count > 0 Then
For Each itm In myItms
If itm.Unread = True Then
'On Error Resume Next
ReceivedTime = itm.ReceivedTime
If ReceivedTime <= DateAdd("m", -1, Now) Then
MsgBox ("Problem.....")
End If
Todays Date is 9/29/2005.
I am using a DateFrom value of 9/1/2005 and a DateTo value of 10/1/2005. I
have the On Error Resume Next statment commented out.
SFilter becomes:
sFilter = [ReceivedTime] >= "Sep, 01 2005 12:00 AM" AND [ReceivedTime] <
"Sep, 20 2005 12:00 AM"
This does not throw an error but also does not filter out messages that do
not meet the sFilter condition. What am I doing wrong?
Thanks so much for your help