![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am using the following code to select a contact for updating.
Set myItem = myContacts.Items.Find("[FirstName] = " & strFirstName & " and [LastName] = " & strLastName & "") This works, but I also need to check that another field [Customer ID] is null before making the update. Is that possible? |
Ads |
#2
|
|||
|
|||
![]() When Find has returned an item, check its property. -- Best regards Michael Bauer - MVP Outlook : Outlook Categories? Category Manager Is Your Tool : VBOffice Reporter for Data Analysis & Reporting : http://www.vboffice.net/product.html?pub=6&lang=en Am Sat, 18 Apr 2009 17:12:01 -0700 schrieb Gitche Gumee: I am using the following code to select a contact for updating. Set myItem = myContacts.Items.Find("[FirstName] = " & strFirstName & " and [LastName] = " & strLastName & "") This works, but I also need to check that another field [Customer ID] is null before making the update. Is that possible? |
#3
|
|||
|
|||
![]()
This is helpful, but I'm still having trouble. I'm new to Outlook VBA; maybe
I don't know the right syntax. Here's my code: Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts) Set myItem = myContacts.Items.Find("[FirstName] = " & strFirstName & " and [LastName] = " & strLastName & "") While TypeName(myItem) "Nothing" If IsNull(myItem.CustomerID) Then myItem.CustomerID = strCustomerID myItem.User2 = strEntryID myItem.Save End If Set myItem = myContacts.FindNext Wend The error number is 438, "Object doesn't support this property or method." I have also tried If myitem.CustomerID = "", with same error. "Michael Bauer [MVP - Outlook]" wrote: When Find has returned an item, check its property. -- Best regards Michael Bauer - MVP Outlook : Outlook Categories? Category Manager Is Your Tool : VBOffice Reporter for Data Analysis & Reporting : http://www.vboffice.net/product.html?pub=6&lang=en Am Sat, 18 Apr 2009 17:12:01 -0700 schrieb Gitche Gumee: I am using the following code to select a contact for updating. Set myItem = myContacts.Items.Find("[FirstName] = " & strFirstName & " and [LastName] = " & strLastName & "") This works, but I also need to check that another field [Customer ID] is null before making the update. Is that possible? |
#4
|
|||
|
|||
![]()
Got it. Here is the fixed code:
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Ite ms Set myItem = myContacts.Find("[FirstName] = """ & strFirstName & """ and [LastName] = """ & strLastName & """" While TypeName(myItem) "Nothing" If myItem.CustomerID = "" Then myItem.CustomerID = strCustomerID myItem.User2 = strEntryID myItem.Save End If Set myItem = myContacts.FindNext Wend "Michael Bauer [MVP - Outlook]" wrote: When Find has returned an item, check its property. -- Best regards Michael Bauer - MVP Outlook : Outlook Categories? Category Manager Is Your Tool : VBOffice Reporter for Data Analysis & Reporting : http://www.vboffice.net/product.html?pub=6&lang=en Am Sat, 18 Apr 2009 17:12:01 -0700 schrieb Gitche Gumee: I am using the following code to select a contact for updating. Set myItem = myContacts.Items.Find("[FirstName] = " & strFirstName & " and [LastName] = " & strLastName & "") This works, but I also need to check that another field [Customer ID] is null before making the update. Is that possible? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do you find missing calendar items | JHodges | Outlook - Calandaring | 1 | September 14th 08 02:48 AM |
How do I save advanced find criteria for future searches | British Baldeagle | Outlook - Calandaring | 0 | June 25th 08 04:31 PM |
Is it possible to set a default folder for find/save search criteria? | Ian R | Outlook Express | 1 | March 9th 07 12:00 PM |
Items Find | Julieta Prandi | Add-ins for Outlook | 3 | April 7th 06 08:12 PM |
2003 calendar's find, doesn't find items created today till tomarr | Support7556 | Outlook - Calandaring | 11 | January 20th 06 09:54 PM |