title image


Smiley Ungefähr so:




'Hier gelößt mit Tabelle der Anmweldedaten







Option Compare Database

Option Explicit



'FTP

Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _

hHandle As Long, ByVal dwMilliseconds As Long) As Long



Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _

ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long



Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, _

ByVal uExitCode As Long) As Long



Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long



Private Const INFINITE = -1&

Private Const SYNCHRONIZE = &H100000

Private Const WAIT_TIMEOUT = 258&



Public Function WaitShell(Cmdline As String, Optional Mode As Long = vbNormalFocus, _

Optional TimeOut As Long = INFINITE, Optional Terminate As Boolean = True)

Dim pid As Long, pHnd As Long, Ret As Long, Merk As Date



' Start the shelled application:

pid = Shell(Cmdline, Mode)

If pid 0 Then

' Wait for the shelled application to finish:

pHnd = OpenProcess(SYNCHRONIZE, 0&, pid)

Merk = Now + TimeOut / 86400 ' seconds

Do While True

Ret = WaitForSingleObject(pHnd, 0)

If Ret WAIT_TIMEOUT Then Exit Do

If TimeOut INFINITE And Merk < Now Then Exit Do

DoEvents

Loop

If Ret = 0 Then

WaitShell = True

Else

If Terminate Then Ret = TerminateProcess(pHnd, 0&)

WaitShell = Ret

End If

Ret = CloseHandle(pHnd)

Else

WaitShell = Ret

End If

End Function



Public Function Datei_Holen(Dateiname As String, Pfad As String)



Dim Skriptdatei As String

Dim Batchdatei As String

Dim Username As String

Dim Passwort As String



'Dim Dateiname As String

Dim Datei_get As String

Dim Datei_set As String



Dim db As Database

Dim rs As Recordset



Set db = CurrentDb

Set rs = db.OpenRecordset("SELECT * FROM tbl_Anmeldedaten;", dbOpenDynaset)



dbpfad = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))



Skriptdatei = dbpfad & "MYFTP.SCR"

Batchdatei = dbpfad & "MyFTP.bat"







rs.MoveLast

Username = rs!Benutzer

Passwort = rs!Passwort







Datei_get = "'" & Pfad & "(" & Dateiname & ")'"

Datei_set = dbpfad & Dateiname & ".txt"





Open Skriptdatei For Output As #1

Print #1, Username

Print #1, Passwort

Print #1, "cd .."

Print #1, "ASCII"

Print #1, "get " & Datei_get & " " & Datei_set

Print #1, "quit"

Close #1



Open Batchdatei For Output As #1

Print #1, "ftp -i -s:" & Skriptdatei & " dein Internetserver > MyFtp.log"

Print #1, "exit"

Close #1



If Not WaitShell(Batchdatei, 2, 3600) Then

MsgBox "FTP-Fehler"

End If



Kill Skriptdatei

Kill Batchdatei



End Function



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: