Private Sub Compare(ByVal SQLString As String, ByVal SQLString2 As String)
On Error GoTo error
Dim cnDATA As ADODB.Connection
Dim rsDATA2 As ADODB.Recordset
Dim strConn As String
Set cnDATA = New ADODB.Connection
Dim QuestionMsg
If DtbConnError = False Then
strConn = "PROVIDER=SQLOLEDB;"
strConn = strConn & " DATA SOURCE= " & conDataSource & ";INITIAL CATALOG=" & conInitialCatalog & ";"
strConn = strConn & " USER ID=" & conUserID & "; PASSWORD=" & conPassword
cnDATA.Open strConn
End If
Dim TagCol As Tags
Dim temp As String
Set TagCol = gTagDb.QueryForTags("TAG*", roIncludeAnalog)
TagCol.ScanOn roWait
Dim i As Single
If Me.txtQty.Text <> "" Then
i = CSng(Me.txtQty.Text)
If i <> 0 Then
'check if connection available
If DtbConnError = False Then
If Me.cmbIng.Text <> "" Then
Set rsDATA = New ADODB.Recordset
With rsDATA
.ActiveConnection = cnDATA
.Open SQLString
End With
If Not (IsNull(rsDATA("NumKey"))) Then
Dim HIng As Integer
HIng = TagCol.Item("TAG").Value
If HIng <> rsDATA("NumKey") Then
Set rsDATA2 = New ADODB.Recordset
With rsDATA2
.ActiveConnection = cnDATA
.Open SQLString2
End With
If IsNull(rsDATA2("Name")) Or rsDATA2.EOF = True Then
temp = "unknown"
Else
temp = rsDATA2("Name")
End If
QuestionMsg = MsgBox("Are you sure?", vbYesNo, "Warning")
Select Case QuestionMsg
Case vbYes
TagCol.Item("TAG").PendingValue = rsDATA("NumKey")
End Select
End If
End If
End If
End If
End If
End If
Exit Sub
Error:
MsgBox "Error"
End Sub