VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form frmDisplay 
   Caption         =   "SPA Instruments "
   ClientHeight    =   8235
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11880
   Icon            =   "frmDisplay.frx":0000
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   Picture         =   "frmDisplay.frx":000C
   ScaleHeight     =   8235
   ScaleWidth      =   11880
   WindowState     =   2  'Maximized
   Begin MSCommLib.MSComm MSComm1 
      Left            =   1395
      Top             =   225
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      RThreshold      =   2
   End
   Begin VB.Timer Timer1 
      Interval        =   5
      Left            =   570
      Top             =   405
   End
   Begin VB.CommandButton Command1 
      Cancel          =   -1  'True
      Caption         =   "&Close"
      Height          =   315
      Left            =   10560
      TabIndex        =   6
      Top             =   7560
      Width           =   1185
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   7590
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   11715
      _ExtentX        =   20664
      _ExtentY        =   13388
      _Version        =   393216
      Tab             =   2
      TabHeight       =   520
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      TabCaption(0)   =   "&General"
      TabPicture(0)   =   "frmDisplay.frx":2FCAF
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "Frame1"
      Tab(0).ControlCount=   1
      TabCaption(1)   =   "&Graph"
      TabPicture(1)   =   "frmDisplay.frx":2FCCB
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Frame2"
      Tab(1).ControlCount=   1
      TabCaption(2)   =   "&Details"
      TabPicture(2)   =   "frmDisplay.frx":2FCE7
      Tab(2).ControlEnabled=   -1  'True
      Tab(2).Control(0)=   "Frame3"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).Control(1)=   "Frame4"
      Tab(2).Control(1).Enabled=   0   'False
      Tab(2).ControlCount=   2
      Begin VB.Frame Frame4 
         Caption         =   "Channels"
         Height          =   6900
         Left            =   9120
         TabIndex        =   10
         Top             =   540
         Width           =   2445
         Begin MSFlexGridLib.MSFlexGrid msfChannels 
            Height          =   6585
            Left            =   120
            TabIndex        =   12
            Top             =   240
            Width           =   2160
            _ExtentX        =   3810
            _ExtentY        =   11615
            _Version        =   393216
            Rows            =   30
            Cols            =   7
            FixedCols       =   0
            ScrollBars      =   2
            FormatString    =   "Channel No. |    Data   |  Channel No. |    Data   |     ."
         End
      End
      Begin VB.Frame Frame3 
         Caption         =   "Graph"
         Height          =   6900
         Left            =   150
         TabIndex        =   9
         Top             =   540
         Width           =   8880
         Begin MSChart20Lib.MSChart MSChart2 
            Height          =   6615
            Left            =   120
            OleObjectBlob   =   "frmDisplay.frx":2FD03
            TabIndex        =   11
            Top             =   240
            Width           =   8655
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "Graphs"
         Height          =   6825
         Left            =   -74640
         TabIndex        =   7
         Top             =   600
         Width           =   11175
         Begin MSChart20Lib.MSChart MSChart1 
            Height          =   6525
            Left            =   240
            OleObjectBlob   =   "frmDisplay.frx":32089
            TabIndex        =   8
            Top             =   240
            Width           =   10695
         End
      End
      Begin VB.Frame Frame1 
         Caption         =   "Parameters"
         Height          =   5415
         Left            =   -74850
         TabIndex        =   1
         Top             =   840
         Width           =   11445
         Begin VB.CommandButton cmdConnect 
            Caption         =   "&Connect"
            Height          =   285
            Left            =   10425
            TabIndex        =   14
            Top             =   1065
            Width           =   945
         End
         Begin VB.CommandButton cmdDelete 
            Caption         =   "&Delete"
            Height          =   285
            Left            =   10440
            TabIndex        =   5
            Top             =   780
            Width           =   945
         End
         Begin VB.CommandButton cmdEdit 
            Caption         =   "&Edit"
            Height          =   285
            Left            =   10440
            TabIndex        =   4
            Top             =   495
            Width           =   945
         End
         Begin VB.CommandButton cmdAdd 
            Caption         =   "&Add"
            Height          =   285
            Left            =   10440
            TabIndex        =   3
            Top             =   210
            Width           =   945
         End
         Begin MSFlexGridLib.MSFlexGrid msfParameters 
            Height          =   5115
            Left            =   135
            TabIndex        =   2
            Top             =   210
            Width           =   10335
            _ExtentX        =   18230
            _ExtentY        =   9022
            _Version        =   393216
            Cols            =   10
            FixedCols       =   0
            FocusRect       =   0
            HighLight       =   0
            ScrollBars      =   2
            SelectionMode   =   1
            AllowUserResizing=   1
            FormatString    =   $"frmDisplay.frx":353AD
         End
         Begin VB.Label lblSrno 
            Height          =   240
            Left            =   10560
            TabIndex        =   13
            Top             =   1815
            Visible         =   0   'False
            Width           =   795
         End
      End
   End
End
Attribute VB_Name = "frmDisplay"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public bNewFlag As Boolean
Public rownum As Integer
Dim dtPreviousTime As Date
Dim iIntervalValue As Integer
Dim blnTransferInProgress  As Boolean
Dim packetSize As Integer
Dim packet(25) As String
Dim iDeviceID, iFuncID, iChannels, iBaudRate  As Integer
Dim strDevName, strParam As String

Private Sub cmdAdd_Click()
Dim i, j As Integer

'---first clear the color...
    For i = 1 To msfParameters.Rows - 1
        For j = 0 To msfParameters.Cols - 1
            msfParameters.Row = i
            msfParameters.Col = j
            msfParameters.CellBackColor = vbWhite
        Next
    Next

 lblSrno.Caption = ""
 cmdEdit.Enabled = False
 cmdDelete.Enabled = False

 bNewFlag = True
 
 frmParameters.Show vbModal
 
 '---- POPULATING THE FLEX GRID...
 fnPopParameterFlex
  

End Sub

Private Sub cmdConnect_Click()
 '---set the port 'n other parameters
 fnConnect
 
End Sub

Private Sub cmdDelete_Click()
    Dim con As ADODB.Connection
    Dim rec As ADODB.Recordset
    Set con = modConn.getConnection
    Dim qry As String
    If lblSrno.Caption <> "" Then
        qry = ""
        qry = "delete from modbus where srno = " & lblSrno.Caption
        con.Execute qry
        
        '--- now refresh the flex...
        fnPopParameterFlex
        
        '--- clear the lbl, disable buttons
        lblSrno.Caption = ""
        
         '---disable the buttons
        cmdDelete.Enabled = False
        cmdEdit.Enabled = False

    End If
    
End Sub

Private Sub cmdEdit_Click()
  '---open the form
  frmParameters.Show vbModal
  
  '---disable the buttons
  cmdDelete.Enabled = False
  cmdEdit.Enabled = False

  '---refresh the flex
  fnPopParameterFlex
  
  '---remove the color
  fnRemoveColor
  
End Sub

Private Sub Command1_Click()
 Unload Me
End Sub

Private Sub Form_Load()
 ' Fire Rx Event Every Two Bytes
 MSComm1.RThreshold = 2
 
 MSComm1.EOFEnable = True
 MSComm1.InBufferCount = 0
 
 
 
 
 '---set the buffersize
 'MSComm1.InBufferSize = 256

 ' When Inputting Data, Input 2 Bytes at a time
 'MSComm1.InputLen = 51
 
 '---set focus on first tab
 SSTab1.Tab = 0
 
 '---disable the buttons
 cmdDelete.Enabled = False
 cmdEdit.Enabled = False
 
 '---populate the parameter flex
 fnPopParameterFlex

End Sub

Private Function fnPopParameterFlex()
Dim con As New ADODB.Connection
Dim rec As New ADODB.Recordset
Dim qry As String
Dim X, icnt As Integer

Set con = getConnection

     '---
     qry = ""
     qry = " select count(*) " & _
            " from modbus "
    
      rec.Open qry, con, adOpenDynamic
      If Not rec.EOF Then icnt = CInt(rec.Fields(0)) + 1 '---1 for formatstring
      icnt = IIf(icnt = 1, 2, icnt) '-----default no. of rows in flex grid
      rec.Close
      
      msfParameters.Rows = icnt
     
      qry = " select * from modbus "
      rec.Open qry, con, adOpenDynamic
      
      X = 1 '---since zeroth row contains column headers
      While Not rec.EOF And X < icnt
            msfParameters.Row = X
            msfParameters.Col = 0
            msfParameters.Text = rec.Fields("DEVICE_NAME") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 1
            msfParameters.Text = rec.Fields("STATUS") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 2
            msfParameters.Text = rec.Fields("PARAMETER") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 3
            msfParameters.Text = rec.Fields("DEVICE_ID") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 4
            msfParameters.Text = rec.Fields("COMM_PORT") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 5
            msfParameters.Text = rec.Fields("BAUD_RATE") & ""
    
            msfParameters.Row = X
            msfParameters.Col = 6
            msfParameters.Text = rec.Fields("POLLING_TIME") & ""
            
            msfParameters.Row = X
            msfParameters.Col = 7
            msfParameters.Text = rec.Fields("CHANNELS") & ""
         
            msfParameters.Row = X
            msfParameters.Col = 8
            msfParameters.Text = rec.Fields("function_id") & ""
            
            msfParameters.Row = X
            msfParameters.Col = 9
            msfParameters.Text = rec.Fields("srno") & ""
         
         rec.MoveNext
         X = X + 1
      Wend
    rec.Close
    
    msfParameters.FormatString = "Device                                |    Status     |  Parameter   | Device ID  |   Port    |   Baud Rate    |  Polling Time  |  Channels  |     Function    |      . "

End Function


Private Sub Form_Unload(Cancel As Integer)
 '---close the port
 If MSComm1.PortOpen Then MSComm1.PortOpen = False
End Sub

Private Sub MSComm1_OnComm()

Dim sData As Variant
Dim temp As Variant
Dim lHighByte As Long
Dim lLowByte As Long
Dim lByte As Long
Dim i As Integer

'sData = ""
'temp = ""

 ' If Rx Event then get data and process
 
 
 'If MSComm1.CommEvent = comEvReceive Then
    'sData = MSComm1.Input ' Get data
    
    
     'MsgBox (Len(str))
    'IfElse Len(sData) = 8
    'sData = 0
     'sData = MSComm1.Input
    'MSComm1.CommEvent = comEvReceive
  '  sData = MSComm1.Input
    ' Ge
     'MsgBox (Len(str))
    'temp = MSComm1.Input
    'ElseIf
    'temp1 = MSComm1.Input
    'sData = temp
   ' MsgBox (MSComm1.InBufferCount)
   
     If sData <> "" Then
       fnPopChannelFlex sData
       fnAddData sData
       fnPopChart sData

       
       
       'fnPopChannelFlex sData
'      lHighByte = Asc(Mid$(sData, 1, 1)) ' get 1st byte
     End If
 'End If
 'End If
End Sub

Private Sub msfParameters_Click()
  Dim i, j, iTemp As Integer


'----changing the background color of the selected row
    iTemp = msfParameters.Row
    '---first clear the color...
    For i = 1 To msfParameters.Rows - 1
        For j = 0 To msfParameters.Cols - 1
            msfParameters.Row = i
            msfParameters.Col = j
            msfParameters.CellBackColor = vbWhite
        Next
    Next
    
    msfParameters.Row = iTemp

    For j = 0 To msfParameters.Cols - 1
        msfParameters.Col = j
        msfParameters.CellBackColor = RGB(170, 185, 253) '---light blue
    Next

'---resetting the value of label
lblSrno.Caption = ""

 msfParameters.Col = 9
 If msfParameters.Row > 0 And msfParameters.Text <> "" Then
      lblSrno.Caption = msfParameters.Text
          
      cmdEdit.Enabled = True
      cmdDelete.Enabled = True
    
  Else
      cmdEdit.Enabled = False
      cmdDelete.Enabled = False
  End If

End Sub

Private Function fnRemoveColor()
  Dim i, j, iTemp As Integer


'----changing the background color of the selected row
    iTemp = msfParameters.Row
    '---first clear the color...
    For i = 1 To msfParameters.Rows - 1
        For j = 0 To msfParameters.Cols - 1
            msfParameters.Row = i
            msfParameters.Col = j
            msfParameters.CellBackColor = vbWhite
        Next
    Next
    
    msfParameters.Row = iTemp

End Function

Private Function fnPopChart(ByVal str As String)
Static ChannelData(1 To 61, 1 To 24) As Variant
Dim i, iTemp, iChann As Integer
Dim fir, sec As Integer
rownum = 2
 For i = 1 To 24
  ChannelData(1, i) = "Channel " & i
 Next i
 
 iChann = Asc(Mid$(str, 3, 1))
 MSChart1.ColumnCount = iChann / 2
 MSChart1.ShowLegend = True
 MSChart2.ColumnCount = iChann / 2
 MSChart2.ShowLegend = True

 For i = 4 To (iChann + 3)
 fir = Asc(Mid$(str, i, 1))
   i = i + 1
   sec = Asc(Mid$(str, i, 1))
   iTemp = fir * 256 + sec
 ' iTemp = Asc(Mid$(str, i, 1)) * 256 + Asc(Mid$(str, i + 1, 1))
  i = i + 1
  ChannelData(rownum, i) = iTemp
' Next i
 
 MSChart1.ChartData = ChannelData
 MSChart2.ChartData = ChannelData
 rownum = rownum + 1
 Next i
 
 If rownum = 62 Then
  Erase ChannelData
  rownum = 2
 End If
 
End Function

Private Sub Timer1_Timer()

Dim dtCurrentTime As Date
'---------------------------------------
Dim sData As Variant
Dim temp As Variant
Dim lHighByte As Long
Dim lLowByte As Long
Dim lByte As Long
Dim i As Integer

'---------------------------------------
dtCurrentTime = Now
Timer1.Enabled = False
If MSComm1.PortOpen = True Then
    'If elapsed time since the last transfer is more than
    'the selected seconds, minutes, or hours, do a data transfer.
    If DateDiff("s", dtPreviousTime, dtCurrentTime) >= _
            iIntervalValue Then
        dtPreviousTime = dtCurrentTime
        'But don't start a new transfer if one is in progress.
        If blnTransferInProgress = False Then
            'Call TransferData(DataTransferFormat)
            fnSend
            
   '----------------------------------------------------
            If MSComm1.CommEvent = comEvReceive Then
    sData = MSComm1.Input ' Get data
     'MsgBox (Len(str))
    'IfElse Len(sData) = 8
    'sData = 0
     'sData = MSComm1.Input
    'MSComm1.CommEvent = comEvReceive
  '  sData = MSComm1.Input
    ' Ge
     'MsgBox (Len(str))
    'temp = MSComm1.Input
    'ElseIf
    'temp1 = MSComm1.Input
    'sData = temp
   ' MsgBox (MSComm1.InBufferCount)
   
     If sData <> "" Then
       fnPopChannelFlex sData
    
    ' cheku data here
    
      ' fnAddData sData
      ' fnPopChart sData
       
       
       'fnPopChannelFlex sData
'      lHighByte = Asc(Mid$(sData, 1, 1)) ' get 1st byte
     End If
 End If
 '-----------------------------------------------
            
            
            
            
            
            
            'MSComm1_OnComm
        End If
    End If
 End If
 Timer1.Enabled = True
End Sub

Private Function fnConnect()
 Dim con As New ADODB.Connection
 Dim rec As New ADODB.Recordset
 
 Dim cLo, cHi, Hi, Lo As Byte
 Dim i, j As Integer
 Dim err, val As Long
 Dim CRCHi, val1, val2 As Byte
 Dim CRCLo As Byte
 
 Dim qry, strPort As String
 
 '---close already opened port
 If MSComm1.PortOpen Then MSComm1.PortOpen = False
     
 '---set the baud rate 'n port, for the selected device
 If (lblSrno.Caption) <> "" Then
  
 Set con = getConnection
 
 qry = ""
 qry = " Select * from modbus where srno = " & Trim(lblSrno.Caption)
 rec.Open qry, con, adOpenForwardOnly
  
  If Not rec.EOF Then
    iBaudRate = CInt(Left(Trim(rec.Fields("baud_rate")), Len(Trim(rec.Fields("baud_rate"))) - 4))
    strPort = rec.Fields("comm_port") & ""
    iIntervalValue = rec.Fields("polling_time")
    
    'Timer1.Interval = iIntervalValue * 1000
    
    '---select function and device id also
    iDeviceID = rec.Fields("device_id")
    iChannels = rec.Fields("channels")
    
    '---set device name, parameter for chart
    strDevName = rec.Fields("device_name") & ""
    strParam = rec.Fields("parameter") & ""
    
    Select Case Trim(rec.Fields("function_id"))
     Case "Read Registers (04)"
      iFuncID = 4
     Case "Write Registers(01)"
       iFuncID = 1
    End Select
    
  End If '---rec.EOF
  
  rec.Close
 Else
  MsgBox "Please select the device.", vbInformation, "Select Device"
  Exit Function
 End If '---(lblSrno.Caption) <> ""
 
  MSComm1.RThreshold = 2
 
 '---set the port
 Select Case strPort
  Case "COM1"
    MSComm1.CommPort = 1
  Case "COM2"
    MSComm1.CommPort = 2
  Case Else
    MsgBox "Please select the valid port.", vbInformation, "InValid Port"
    msfParameters.SetFocus
    Exit Function
 End Select
 
 '---set the baud rate alongwith  no parity, 8 data bits, 1 stop bit
 MSComm1.Settings = iBaudRate & ",N,8,1"
    
 ' Open the port
 MSComm1.PortOpen = True

 '---set the packet size according to no. of bytes required
 packetSize = 2 + 4

 dtPreviousTime = Now
 blnTransferInProgress = False
 
 '---set the no. of columns for graph as per no. of channels
 MSChart1.ColumnCount = iChannels
 MSChart1.Title.Text = "Device : " & strDevName & "          Parameter : " & strParam
 
 MSChart2.ColumnCount = iChannels
 MSChart2.Title.Text = "Device : " & strDevName & "          Parameter : " & strParam
 
 '---set the channel no.s labels
' For j = 0 To MSChart1.ColumnCount - 1
'  MSChart1.ColumnLabelCount = j
'  MSChart1.Col
' Next
 
 '---form the packet
 packet(0) = iDeviceID       '0x01; /*device no*/
 packet(1) = iFuncID         '0x04; /*function*/
 packet(2) = 0               '0x00; /*starting address HI*/
 packet(3) = 0               '0x00; /*starting address LO*/
 packet(4) = 0               '0x00;
 packet(5) = iChannels       'channelNos;
 
 
     '--- the two bytes of the Error Code
     
    CRCHi = &HFF
    CRCLo = &HFF
    err = CLng(CRCHi) * &H100 Or CLng(CRCLo)

   '---- the Anding Number cal as Hex A001
   
    val1 = &HA0
    val2 = &H1
    val = CLng(val1) * &H100 Or CLng(val2)
    
    
   '----  the CRC calculation starts from here
   
    For i = 0 To packetSize - 1        '--- for the packet size
   
    err = CLng(err) Xor packet(i)
    
    For j = 0 To 7           ' --- for the 8 bits of each byte

    If (CLng(err) And CLng(1)) Then  '-- if 1 in the LSB bit

    err = CLng(err) \ CLng(2)
    err = CLng(err) Xor CLng(val)
    Else
    
    err = CLng(err) \ CLng(2)     '-- zero in the LSB bit
    End If

    Next j
    Next i
   
    cLo = CLng(err) And CLng(CRCHi)   ' --- the cLo Byte
    cHi = CLng(err) \ CLng(2 ^ 8)     ' ----- the cHi Byte

    packet(6) = cLo
    packet(7) = cHi
 
 fnSend
 If cmdConnect.Caption = "&Connect" Then cmdConnect.Caption = "&DisConn." Else cmdConnect.Caption = "&Disconnect"
 
 'Timer1.Enabled = True
 
End Function

Private Function fnSend()
Dim j As Integer
packetSize = 8
 '---set the trnsfer flag to true
 blnTransferInProgress = True
 
 '---transmit the data
 For j = 0 To packetSize - 1
  MSComm1.Output = Chr$(packet(j))
 Next j

 '---set the trnasfer flag to false
 blnTransferInProgress = False
 
End Function

Private Function fnPopChannelFlex(ByVal str As String)
Dim i, iRow, iChann    As Integer
 Dim fir, sec As Integer
 Dim iTemp As Long
 iChann = Asc(Mid$(str, 3, 1))
 
 msfChannels.Clear
 msfChannels.FormatString = "Channel No. |    Data   |  Channel No. |    Data   |     ."
 
 For i = 4 To (iChann + 3)
   'If i Mod 2 = 0 Then MSChart1.Column = i
   'DoEvents
   
   'MsgBox (Len(str))
   
   
'   iTemp = Asc(Mid$(str, i, 1)) * 256 + Asc(Mid$(str, i + 1, 1))
   fir = Asc(Mid$(str, i, 1))
   i = i + 1
   sec = Asc(Mid$(str, i, 1))
   iTemp = fir * 256 + sec
   '---set channel no.
   msfChannels.Col = 0
   msfChannels.Row = (i - 1) / 2 - 1
   msfChannels.Text = (i - 1) / 2 - 1
   
   '---set channel data
   msfChannels.Col = 1
   msfChannels.Row = (i - 1) / 2 - 1
   msfChannels.Text = iTemp
   
  
 Next i
End Function

Private Function fnAddData(ByVal str As String)

'Dim con As New ADODB.Connection
'Dim iChann As Integer
'Dim qry As String
'Dim i As Integer
'Dim ITemp As Long
'Dim curTime As String
'
'iChann = Asc(Mid$(str, 3, 1))
'curTime = Format(Now, "hh:mm:ss dd-mm-yy")
'qry = "INSERT INTO ChannelData( Time, Ch1, Ch2"  ', Ch3, Ch4, Ch5, Ch6, Ch7, Ch8"
'
'If iChann = 16 Then
'  qry = qry & ") VALUES ( '" & curTime & "', "
'Else
'  qry = qry & ", Ch9, Ch10, Ch11, Ch12, Ch13, Ch14, Ch15, Ch16"
'  If iChann = 16 Then
'    qry = qry & ") VALUES ( '" & curTime & "', "
'  Else
'    qry = qry & ", Ch17, Ch18, Ch19, Ch20, Ch21, Ch22, Ch23, Ch24) VALUES ( " & curTime & ", "
'  End If
'End If
' iChann = Asc(Mid$(str, 3, 1))
' For i = 4 To 7 '(iChann + 3)
'
'   ITemp = Asc(Mid$(str, i, 1)) * 256 + Asc(Mid$(str, i + 1, 1))
'   i = i + 1
'
'  If i < 6 Then '(iChann + 2) Then
'    qry = qry & ITemp & ", "
'  Else
'    qry = qry & ITemp & ")"
'  End If
'
'Next i
'
'MsgBox "qry :: " & qry
'
'Set con = getConnection
'
'con.Execute qry

End Function



