benjamin.grimm
Registered User.
- Local time
- Today, 06:32
- Joined
- Sep 3, 2013
- Messages
- 125
Hello guys,
i have a database, which analyse rent contracts.
I export each rent contract to excel by the following code.
Each contract gets each spreadsheet. So right now i export all contracts.
Is it possible that, before the exports starts that an inport box shows up and the user can enter special contracts by SUWID number?
For example 5,6,7 and 10.
Greetz benjamin
i have a database, which analyse rent contracts.
I export each rent contract to excel by the following code.
Each contract gets each spreadsheet. So right now i export all contracts.
Code:
Private Sub Befehl1_Click()
Dim xlApp As Object 'Excel.Application
Dim xlBook As Object 'Excel.Workbook
Dim xlSheet As Object 'Excel.Worksheet
Dim rstID As DAO.Recordset, tmpStr As String
Dim rstGr As DAO.Recordset, strSQL As String
strSQL = "SELECT SuWID FROM Abfrage_alles GROUP BY SuWID;"
Set rstID = CurrentDb.OpenRecordset(strSQL)
If rstID.RecordCount > 0 Then
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open("S:\Access\SuW\Excel-Tabellen\ID.xlsm")
Do While Not rstID.EOF
Set xlSheet = xlBook.Sheets("Tabelle " & rstID.Fields("SuWID"))
xlSheet.Name = "ID" & rstID.Fields("SuWID")
Set rstGr = CurrentDb.OpenRecordset("SELECT SAP, Geris, Pauschale, SuWID, Jahr_Y, BT_Name, SAP_Nummer FROM Abfrage_alles WHERE SuWID = " & rstID.Fields("SuWID"))
xlSheet.Range("A4").CopyFromRecordset rstGr
rstGr.Close
rstID.MoveNext
Loop
Else
MsgBox "No information to export", vbInformation, "No data exported"
End If
rstID.Close
Set rstID = Nothing
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
Is it possible that, before the exports starts that an inport box shows up and the user can enter special contracts by SUWID number?
For example 5,6,7 and 10.
Greetz benjamin