cj92713696
Programmer
Private Sub issueDeleteByStore(strTableName As String, strStoreCode As String)
On Error GoTo errorMsg:
Dim strSQL As String
Dim lngCounter As Long
Dim sqlRS As New ADODB.Recordset
dbUtils.closeTbl sqlRS
strSQL = "SELECT * FROM " & strTableName & " WHERE " & strTableName & _
".StoreCode = '" & strStoreCode & "'"
sqlRS.Open strSQL, DE.fatsales_SQL.ConnectionString, adOpenStatic, adLockPessimistic
MsgBox sqlRS.RecordCount
If dbUtils.IsRSOpen(sqlRS) = True Then
If sqlRS.RecordCount > 0 Then
sqlRS.Delete
End If
End If
dbUtils.closeTbl sqlRS
sqlRS.Open strSQL, DE.fatsales_SQL.ConnectionString, adOpenStatic, adLockPessimistic
MsgBox sqlRS.RecordCount
dbUtils.closeTbl sqlRS
GlobalAccess.addDbHistory _
strStoreCode, _
"SQL Server database delete; table: " & strTableName & _
", store code: " & strStoreCode
Exit Sub
errorMsg:
MsgBox "issueDeleteByStore subroutine error: " & strSQL & vbCrLf & _
Err.Number & " - " & Err.Description, vbCritical, "Error"
End
End Sub
On Error GoTo errorMsg:
Dim strSQL As String
Dim lngCounter As Long
Dim sqlRS As New ADODB.Recordset
dbUtils.closeTbl sqlRS
strSQL = "SELECT * FROM " & strTableName & " WHERE " & strTableName & _
".StoreCode = '" & strStoreCode & "'"
sqlRS.Open strSQL, DE.fatsales_SQL.ConnectionString, adOpenStatic, adLockPessimistic
MsgBox sqlRS.RecordCount
If dbUtils.IsRSOpen(sqlRS) = True Then
If sqlRS.RecordCount > 0 Then
sqlRS.Delete
End If
End If
dbUtils.closeTbl sqlRS
sqlRS.Open strSQL, DE.fatsales_SQL.ConnectionString, adOpenStatic, adLockPessimistic
MsgBox sqlRS.RecordCount
dbUtils.closeTbl sqlRS
GlobalAccess.addDbHistory _
strStoreCode, _
"SQL Server database delete; table: " & strTableName & _
", store code: " & strStoreCode
Exit Sub
errorMsg:
MsgBox "issueDeleteByStore subroutine error: " & strSQL & vbCrLf & _
Err.Number & " - " & Err.Description, vbCritical, "Error"
End
End Sub