• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 34. Advanced Outlook Programming... > Transferring Outlook Information To ...

Transferring Outlook Information To or From a Database

Many companies use Microsoft Access or SQL Server to store contact or product information. You can use Outlook custom forms to take information from or write information to a database using ADO (ActiveX Data Objects). In the following example, information from the Frame Order System is transferred to an Access database for reporting purposes:

Sub cmdSubmit_Click()

Dim objConnection
Dim objRecordset
Dim strSQL

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Mode = 3
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data_
strSQL = "SELECT * FROM FrameInformation;"
Set objRecordset = CreateObject("ADODB.Recordset")
objRecordset.Open strSQL, db2,2,3
objRecordset.Fields("CustomerName") = Item.UserProperties("CustomerName")
objRecordset.Fields("CustomerCode") = Item.UserProperties("CustCode")
objRecordset.Fields("CreationDate") = Item.UserProperties("CreationDate")
objRecordset.Fields("OrderNumber") = Item.UserProperties("OrderNumber")
objRecordset.Fields("SalesRep") = Item.UserProperties("SalesRep")
objRecordset.Fields("Status") = Item.UserProperties("Status")
Set objRecordset = Nothing
Set objConnection = Nothing

End Sub




Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint