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)))
5e08a98a-7ef0-481e-880b-14739e92a40d|0|.0
Free Message Board Program
This program has 8 boxes in which you can enter, or paste, large amounts of text and images. You can use the tab to align your text and the enter key for newline. Each box can be moved to any position with the mouse. Right clicking the mouse brings up a menu to change the font, font color,background color, right, left, center align selected text, bullet text, insert current date and/or time and save the contents of the active box.
The individual text boxes are saved in their own Rich Text files which can be read by any word processor and will retain all formatting.
Below is a screen capture.
Click here to download Message Board
96136ab6-028f-4095-9d19-9a72cb5c164b|0|.0