I just finished writing an application to automate the import of Outlook contacts into a Microsoft Jet Engine 4.0 database, which can be used by Access as well as the .Net languages.

The first, and hardest, problem to solve was fields in Outlook which contain no value are given a value of Nothing. Nothing means that the parameter does not exist and  an error is generated. I finally decided to assign each Outlook field to a string array variable. When I tested the string variable for Nothing, I got variable not declared error. I have never had this problem before. I still don't know why I got it, but this was the solution I found: Dim z As Array = Array.CreateInstance(GetType(String), 61).

Not much code but it took weeks to figure out.

There is another way to do. Test Outlook field directly as follows:

If    objContact.FirstName isNothing Then

      command.Parameters.Add(New OleDbParameter("FirstName", objContact.FirstName)).Value=""
else
      command.Parameters.Add(New OleDbParameter("FirstName", objContact.FirstName))

End If

There is a lot less typing assigning each Outlook field to an array variable and testing as follows:

For i = 0 To 60
  If z(i) Is Nothing Then
    z(i) = ""
  End If
Next

My last tip is Clear the parameters collection before starting a new loop. If you don't the first set of values will be inserted for each loop.

command.Parameters.Clear()
   'If you don't clear parameters, it will repeat first value.
command.Parameters.Add(New OleDbParameter("Assistant", z(0)))