Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > ADO connection from Outlook form

Reply
Thread Tools

ADO connection from Outlook form

 
 
Joker Joker is offline
Junior Member
Join Date: Mar 2007
Posts: 4
 
      03-20-2007
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 by Joker; 03-20-2007 at 04:17 PM..
Reply With Quote
 
 
 
 
Joker Joker is offline
Junior Member
Join Date: Mar 2007
Posts: 4
 
      03-21-2007
Problem solved. Now I need to show the selected data on re-opening.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Translating Oracle Package Call from ADO to ADO.Net dmiratsky@yahoo.com ASP .Net 0 02-14-2005 10:39 PM
Transfer ADO Code to ADO.NET ronaldlee ASP .Net 1 12-17-2004 04:08 PM
Accessing an ADO Recordset or Record from ADO.NET nita ASP .Net 1 11-20-2004 07:06 AM
ASP.NET using ADO.NET connection runtime error Matt ASP .Net 1 10-27-2003 04:14 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments