Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • Last Modified:

Find ReceivedTime or EntryID Format

Hi guys

I have saved the outlook inbox mails in an Access mdb,
now I want to move a certain email to another directory in outlook(no problem with this part),
but I want to compare either the EntryID or the ReceivedTime, between what's in the mdb Form with that of the inbox, then move the email (unless there is an easier way!).

the following give me type mismatch, so I know it is about the format:

strSearch2 = "[ReceivedTime] = '" & Format([ReceivedTime], "dd-mmm-yy h:nn:ss AMPM") & "'"
   Set OlItemLocate = OlFolder.Items.Find(strSearch2)

strSearch4 = "[ReceivedTime] = " & Chr(34) & Forms!frmMainMail!sfrmMail!ReceivedTime & Chr(34)
   Set OlItemLocate = OlFolder.Items.Find(strSearch4)


I can do a loop through all the emails in the inbox, but that takes a long time, where as the FIND method is much faster.

Could you please give me the correct format to check for either ReceivedTime or the EnteryID (it says, the property 'EnteryID" in the condition is not valid).

OR another way to compare the email between my Form and the Outlook inbox.

thanks

jaffer
0
jjafferr
Asked:
jjafferr
  • 3
  • 3
1 Solution
 
jjafferrAuthor Commented:
I found today that Outlook will accept almost any Format, but NOT seconds,
this makes it even more diffecult, as now we have to look at 1 minute before and one minute after.


strSearch2 = "[ReceivedTime] = '" & Format([ReceivedTime], "dd-mmm-yy hh:nn") & "'"
   Set OlItemLocate = OlFolder.Items.Find(strSearch2)

should work.

But any further help to locate/search/find an email in the fastest way is appreciated.

jaffer
0
 
BerduchwalCommented:
How about using 24hour clock?
Format(oEml.SentOn, "DD MMM YY HH:MM:SS"))
0
 
jjafferrAuthor Commented:
Nope, type mismatch

I was able to make work with:
   
   strSearch4 = "[ReceivedTime] >= " & Chr(34) & Format(Forms!frmMainMail!sfrmMail!ReceivedTime, "dd-mmm-yy h:nn") & Chr(34) & " AND [ReceivedTime] < " & Chr(34) & Format(DateAdd("n", 1, Forms!frmMainMail!sfrmMail!ReceivedTime), "dd-mmm-yy h:nn") & Chr(34)
   Set OlItemLocate = OlFolder.Items.Find(strSearch2)

but now I will have to loop through the 1 minute emails, and assuming 1 email every second (I know I am pushing :o), so I will have to loop using find next, and compare the EntryID's.

I haven't got that far yet, but that will be my next step.

unless you have a better idea ?

jaffer
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
BerduchwalCommented:
I do not understand why you use:
dd-mmm-yy h:nn
not
dd-mmm-yy h:mm
--
nn stands for what?
0
 
jjafferrAuthor Commented:
in order for the code not to get confused, they use nn for minutes
0
 
BerduchwalCommented:
I do not have much of the experience with this but maybe try using MM not NN and check if this works.
Otherwise I do not know.
0
 
GranModCommented:
Closed, 500 points refunded.

GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now