Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dateien automatisiert einlesen!

Empfohlene Antworten

Veröffentlicht

Hallo,

Also ich habe ein VBscript(6.0) das mir eine Textdatei nimmt, umformatiert und in eine Access Datenbank schreibt, ist soweit alles wunderbar.

Ich möchte nun, dass ich mehrer Dateien gleichzeitig einlesen kann, die Dateien heissen zb, funk_2005_07_08.txt ich möchte ihm quasi sagen:

lies mir die dateien von 2005-06-06 bis 2005-08-08 ein,

wenn eine Datei leer, bzw nicht vorhanden, (weil es gibt nicht von jedem Tag eine Datei)

dann überspringen und mit der nächsten weitermachen.

Hat da einer von euch vielleicht ein stück Code, das mir weiterhilft oder so :-)

VBscript(6.0)

VBS oder VB6?

Access Datenbank

womit greifst du damit zu, DAO, ADO, ODBC?

s'Amstel

VB 6.0

So hier mal der Code, damit wirds vielleicht einfacher :-)

'********************************************************************

 'Button zum Importieren von Eingriff

'--------------------------------------------------------------------

Private Sub imeingriff_Click()

On Error GoTo Err_imeingriff_Click


Dim Path As String

    Dim strFileName As String

    Dim ersterb As String

    Dim Dateinummer As Integer

    Dim Textzeile



'HIER KANN VON HAND GEPFLEGT WERDEN!



    If ((IsNull(Me![Dateipfad])) Or (Me![Dateipfad] = "")) Then

        Me![Dateipfad] = DateiOeffnen("C:\Logistik EDV\logs", "Datei öffnen")  'Me![Dateipfad] = Pfad, in

    Else                                                                                        'den der Öffnen-Dialog springt,

        Me![Dateipfad] = DateiOeffnen(Me![Dateipfad], "Datei öffnen")                           'falls kein anderer ausgwählt wurde

    End If



'-------------------------------------------------------

' Automatisches setzten, der Importeinstellungen


    strFileName = Right$(Dateipfad, Len(Dateipfad) - _

    InStrRev(Dateipfad, "\"))                               'Herausfiltern des Dateinamens


    ersterb = Left(strFileName, 1)                          'Abschneiden des ersten Buchstabens der Datei


    If ersterb = "e" Then

            Dateipfad_imp = "EINGRIEFE"

            Table = "EINGRIEFE"

            Spez = "EINGRIFFE_Importspezifikation"

'     ElseIf ersterb = "f" Then

'            Dateipfad_imp = "FUNK_FILE"

'            Table = "FUNK_FILE"

'            Spez = "FUNK_Importspezifikation"

'     ElseIf ersterb = "m" Then

'            Dateipfad_imp = "MATBEW_2004"

'            Table = "MATBEW_2004"

'            Spez = "MATBEW_Importspezifikation"

    Else: GoTo Err_imeingriff_errordatei_Click


    End If

'-------------------------------------------------------


    DoEvents


    If ((Not IsNull(Me![Dateipfad])) And (Me![Dateipfad] <> "")) Then

        DoCmd.Hourglass True

        Dateinummer = FreeFile

        Open Me![Dateipfad] For Input As #Dateinummer

            While Not EOF(Dateinummer)

'            Me.[Textfeld] = ""                  'löscht vor jedem Öffnen, den Inhalt des Textfeldes

            Line Input #Dateinummer, Textzeile

            Me![Textfeld] = Me![Textfeld] & Textzeile & vbCrLf

        Wend

        Close #Dateinummer

    End If


'Importieren

'--------------------------------------------------------------------



    Dim Path2 As String

    Dim Dateinummer2 As Integer

    Dim Textzeile2




     If ((Not IsNull(Me![Dateipfad])) And (Me![Dateipfad] <> "")) Then

        DoCmd.Hourglass True

        Dateinummer2 = FreeFile

        Open Me![Dateipfad] For Input As #Dateinummer2

        Close #Dateinummer2


        DoCmd.TransferText acImportFixed, Spez, Table, Me![Dateipfad], False, ""

     End If


     MsgBox "Importieren erfolgreich", vbInformation


'--------------------------------------------------------------------------


Exit_imeingruff_Click:

    DoCmd.Hourglass False

    Exit Sub


Err_imeingriff_errordatei_Click:

    MsgBox "Sie haben eine Falsche Datei ausgewählt", vbCritical


Err_imeingriff_Click:

    MsgBox "Importieren nicht erfolgreich", vbCritical



End Sub

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.