Imports DocumentFormat.OpenXml.Wordprocessing Public Class frmDatenarchivarchiv Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Me.Cursor = Cursors.WaitCursor Dim DT = SQL.loadDgvBySql(" SELECT TOP (1) [da_id] FROM [tblDatenarchiv] inner join tblDatenarchiv_Collection on da_id=coll_daId where da_vorlage=0 and coll_date BETWEEN '" & txtVon._value & "' and '" & txtBis._value & "' and coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' AND da_kategorie='" & txtKategorie.Text & "' and da_ordner='" & txtOrdner.Text & "' group by [da_id] ", "FMZOLL") MsgBox(" SELECT TOP (1) [da_id] FROM [tblDatenarchiv] inner join tblDatenarchiv_Collection on da_id=coll_daId where da_vorlage=0 and coll_date BETWEEN '" & txtVon._value & "' and '" & txtBis._value & "' and coll_pfad NOT LIKE '%\\stor01.verag.ost.dmn\DatenArchivArchiv%' AND da_kategorie='" & txtKategorie.Text & "' and da_ordner='" & txtOrdner.Text & "' group by [da_id] ") If DT Is Nothing Then Me.Cursor = Cursors.Default : Exit Sub If DT.Rows.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub If vbYes = MsgBox("Es werden '" & DT.Rows.Count & "' Einträge verschoben - fortfahren?", vbYesNoCancel) Then ProgressBar1.Minimum = 1 ProgressBar1.Maximum = DT.Rows.Count ProgressBar1.Step = 1 For Each ROW In DT.Rows 'Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(txtKategorie._value, txtOrdner._value, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, txtMax._value) Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(ROW("da_id")) If DS.DATA_LIST.LIST.Count > 0 Then DS.moveTo_ARCHIVARCHIV() End If ProgressBar1.PerformStep() Next End If Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name) End Try Me.Cursor = Cursors.Default End Sub End Class