How to display ADO odbc-connection result?

  • Thread starter Anders Ekström
  • Start date
A

Anders Ekström

Hi!

Does anyone know the correct syntax to get the result from the folowing
ado-connection into one of the custom properties fields in a, for the
moment, selected shape?

The folowing code works perfectly if i present the result in a msgbox
instead.

--------------------------------------------------------------------
Public Sub SQL()

Dim MyCon As New ADODB.Connection
Dim MySet As New ADODB.Recordset
Dim sCon As String
Dim shpobj As Visio.Shape
Dim cellobj As Visio.Cell
Dim strsiteid As String
Dim strcell As String
Dim selObj As Visio.Selection


Load UserForm1
UserForm1.Show

strsiteid = UserForm1.TextBox1.Text
strcell = "Prop.siteid"

sCon = "dsn=Celltracker;uid=ctuser;pwd=password"
MyCon.ConnectionString = sCon


MyCon.ConnectionTimeout = 10
MyCon.Properties("Prompt") = adPromptNever
MyCon.CursorLocation = adUseClient
MyCon.Mode = adModeRead

MyCon.Open
MySet.Open "SELECT SITE_ID, LABEL FROM SITE where site_id = " & strsiteid,
MyCon


If Not MySet.EOF Then

Sheet1!Prop.Row_1 = MySet!Label << THIS IS NOT CORRECT!!!

End If

MySet.Close
MyCon.Close

Set MyCon = Nothing

End Sub


--------------------------------------------------------------------

Thanks!
best regards
Anders Ekström
(e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top