buddhaman001
Member
Hello all!
I am trying to write an obtained SQL value to a Tag in Factorytalk View SE but am getting "Object Required"
I can write to the tag with "AirportPressure.Value = 10" and the sql code is pulling the correct value from the database, but I can not write it to the tag.
Code below, any help is appreciated! (I have commented the problem area towards the bottom of the snippet below)
I am trying to write an obtained SQL value to a Tag in Factorytalk View SE but am getting "Object Required"
I can write to the tag with "AirportPressure.Value = 10" and the sql code is pulling the correct value from the database, but I can not write it to the tag.
Code below, any help is appreciated! (I have commented the problem area towards the bottom of the snippet below)
Code:
Public UnitronicsTagsMain As TagGroup
Private Sub Display_AnimationStart()
'TagGroup
If UnitronicsTagsMain Is Nothing Then
Set UnitronicsTagsMain = Application.CreateTagGroup(Me.AreaName, 5000)
UnitronicsTagsMain.Add "APortBooster\Pressure"
End If
UnitronicsTagsMain.Active = True
Dim AirportPressure As Tag
Set AirportPressure = UnitronicsTagsMain.Item("APortBooster\Pressure")
'start SQL Connection
Dim conn As ADODB.Connection
Dim rec1 As ADODB.Recordset
Dim thisSql As String
Set conn = New ADODB.Connection
Set rec1 = New ADODB.Recordset
Dim sConn As String
sConn = "Driver={MySQL ODBC 5.3 Unicode Driver};Trusted_Connection=No;Server=192.168.1.106;Database=test;UID=<USER>;PWD=<PASS>"
conn.Open sConn
rec1.Open "SELECT Value FROM values4convert WHERE Tag = 'Pressure'", conn
'GETTING ERROR HERE!
'this works
AirportPressure.Value = 10
'this does not
'AirportPressure.Value = rec1!Value
rec1.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub