Private
Sub
Befehl256_Click()
Dim
db
As
DAO.Database
Dim
rst
As
DAO.Recordset2
Dim
xlApp
As
Object
Dim
xlWb
As
Object
Set
db = CurrentDb
Set
rst = db.OpenRecordset(
"Abfrage Verr_Blöcke"
)
CurrentDb.Execute
"Delete from [Tabelle1]"
, dbFailOnError
Do
While
Not
rst.EOF
With
CurrentDb().OpenRecordset(
"Tabelle1"
, dbOpenDynaset, dbAppendOnly)
.AddNew
!Test = rst!POSITION
.Update
End
With
Debug.Print rst!POSITION
Set
xlApp = CreateObject(
"Excel.Application"
)
xlApp.DisplayAlerts =
False
Set
xlWb = xlApp.Workbooks.Open(Application.CurrentProject.Path &
"\Import_Export_UPRO.xlsm"
)
xlWb.Sheets(
"Tabelle1"
).Range(
"A2:A500"
).ClearContents
xlWb.Save
xlWb.Close
xlApp.Quit
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml,
"Tabelle1"
, _
Application.CurrentProject.Path &
"\Import_Export_UPRO.xlsm"
CurrentDb.Execute
"Delete from [Tabelle1]"
, dbFailOnError
rst.MoveNext
Loop
rst.Close
Set
rst =
Nothing
Set
db =
Nothing
End
Sub