Access.2007.VBA.Bibl..

(John Hannent) #1
& strFirstName & Chr$(39) _
& “ And [LastName] = “ & Chr$(39) _
& strLastName & Chr$(39)
‘Debug.Print “Search string: “ & strSearch

Search by name.

Set con = fldContacts.Items.Find(strSearch)
If TypeName(con) = “Nothing” Then
Debug.Print “Contact name “ & strFirstName _
& “ “ & strLastName & “ not found in “ _
& fldContacts.Name & “ folder”

Create new contact item.

Debug.Print “Creating new contact item with “ _
& “CustomerID “ & strCustomerID
If blnDelete = False Then
Set con = fldContacts.Items.Add
Else
GoTo NextSourceRecord
End If
Else
Debug.Print “Found contact name “ _
& strFirstName _
& “ “ & strLastName
If blnDelete = True Then
con.Delete
GoTo NextSourceRecord
End If
End If
Else
Debug.Print “Found Customer ID “ _
& strCustomerID
If blnDelete = True Then
con.Delete
GoTo NextSourceRecord
End If
End If

Update contact item with values from controls on the Outlook subform:

On Error GoTo ErrorHandler

con.CustomerID = Nz(rstSource![CustomerID])
con.Title = Nz(rstSource![Title])
con.FirstName = Nz(rstSource![FirstName])
con.MiddleName = Nz(rstSource![MiddleName])
con.LastName = Nz(rstSource![LastName])
con.Suffix = Nz(rstSource![Suffix])
con.Nickname = Nz(rstSource![Nickname])

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf