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)
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)