ADO connection from Outlook form

Discussion in 'Software' started by Joker, Mar 20, 2007.

  1. Joker

    Joker

    Joined:
    Mar 14, 2007
    Messages:
    4
    I wrote the following code:
    Public Function SynergyRelaties() As String
    Dim oConnection As ADODB.Connection
    Dim oRecordset As ADODB.Recordset
    Dim sConnect As String
    Dim sQRelatie As String
    Dim sRelaties As String
    Dim sQProject As String
    Dim sProjecten As String
    Dim sQVerzoekType As String
    Dim sVerzoekTypes As String

    sConnect = "DSN=Synergy demo;OLE DB Services=-2;"
    sQRelatie = "SELECT cmp_name FROM cicmpy ORDER BY cmp_name"
    Set oConnection = New ADODB.Connection
    Set oRecordset = New ADODB.Recordset

    oConnection.Open (sConnect)
    oRecordset.Open sQRelatie, oConnection, adOpenStatic, adLockOptimistic
    Do While (Not oRecordset.EOF)
    sRelaties = sRelaties & oRecordset.Fields("cmp_name") & ";"
    oRecordset.MoveNext
    Loop
    SynergyRelaties = sRelaties
    oRecordset.Close
    Set oRecordset = Nothing
    oConnection.Close
    Set oConnection = Nothing
    End Function


    This code builds a comma separated string which I wanna show in a combobox on a custom made Appointment form in Outlook. I have this code:
    Set FormPage = Item.GetInspector.ModifiedFormPages("Synergy data")
    Set Control = FormPage.Controls("cmbRelatie")
    Control.PossibleValues = sSelRelatie


    How do I get the result of the function "SynergyRelaties" available in the code behind the form? Therefore sRelaties should end up in sSelRelatie. I can't 'Call' this function. I started the code on startup (that's not exactly what I want) and stored the result in a public variable but even that didn't help.
    Last edited: Mar 20, 2007
    Joker, Mar 20, 2007
    #1
    1. Advertising

  2. Joker

    Joker

    Joined:
    Mar 14, 2007
    Messages:
    4
    Problem solved. Now I need to show the selected data on re-opening.
    Joker, Mar 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ramie
    Replies:
    4
    Views:
    1,673
    Guest
    Nov 3, 2003
  2. Guest

    ADO Cursor location - HELP

    Guest, Nov 12, 2003, in forum: MCSD
    Replies:
    3
    Views:
    2,828
    Kline Sphere
    Nov 12, 2003
  3. MadMike42

    ODBC or ADO Connection String

    MadMike42, Feb 23, 2006, in forum: Computer Support
    Replies:
    3
    Views:
    624
    MadMike42
    Feb 23, 2006
  4. Mark S.
    Replies:
    5
    Views:
    1,220
    Dan Evans
    May 16, 2006
  5. chintan
    Replies:
    0
    Views:
    1,705
    chintan
    Dec 19, 2007
Loading...

Share This Page