I've been using oContacts.Items.Restrict to determine if a Contact having the same Lastname, Firstname, and Birthday exists. In this case oContacts references iCloud\Contacts. Most of the time it works; but for a significant number of contacts known to exist and created with the same code, the count is 0 when I know that it should be at least 1.
Full Disclosure: I posted this question at Forums.SlipStick.com for few days; but, after more than 240 views have not received any replies I'm hoping someone here can point me in the right direction. FYI, I looked for any instructions regarding cross-posting and did not find any recommended procedures. I trust my acknowledging it will keep me out of any penalty box. Thanks.
The post at SlipStick contains more detail; however, including that detail here prevented me from posting because it "looks like spam". Not sure why, but OK.
Bruce
Firstly, you really need to post all the details here, not just give a link to your first question.
Secondly, never use =
with date-time fields (such as Birthday
) - the condition might not be satisfied because of the rounding errors. Always use a range instead.
Also note that 1/1/4501
is just what Outlook returns for the missing date-time values (since it cannot return null for a scalar value). Take a look at the contact with OutlookSpy (select the contact, click IMessage button).
Thanks for your reply. As indicated in my note, I did try to post all the details here; but, stackoverflow rejected those details as "looks like spam". I did explore your suggestion by setting the sFilter using Round(dtBirthday) instead of just dtBirthday to create and edit a contact known to be problematic. I got the same result -- redundantly created contacts.
I may look at trying a wider range when I get some time to fool around with it. I do understand the 1/1/4501 thing - I set a constant to that value to test for the equivalent of "None" as has been demonstrated in other posts.
Round() won't help you if you are still using
=
. Use a range: (property >date1) and (property < date2)[FirstName] = 'John' and [LastName] = 'Doe' and [Birthday] >= '3/15/1967' and [Birthday] <= '3/15/1967 11:45:36 PM' Worked! I also tried the birthday +/- 0.5 but that did not work. Really strange! Thanks for your help!!!!!