Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    6

    Unanswered: Move file to FTP site!!!Help

    i have the backend of my database currently (where my data is) stored on my machine under (c:\database\data.mdb), and the front end on my desktop. instead of the back end being stored on my local machine, i want to move it to and from my ftp site. why you ask.... because when i open the front end of my database (stored on my desktop) i want it to retreive the backend database file "Data.mdb" from the ftp site and put it in the directory "c:\database\". then when i exit the database i want it to move (not copy) the file "data.mdb" back to the ftp site.

    all i need is a little help with the code....

    i am new to VB. but have written procedures in access for copying files from one location to another, but dont now how to move file to and from an ftp site.

    please help....

    cheers lee

  2. #2
    Join Date
    Nov 2003
    Location
    Warren, PA
    Posts
    52
    I feel you will have a lot of problems with data Integrity but here is the code to do it this code is to download it. Just change for uploading

    on open code
    ____________________________________
    Open FilePath & "GetFile.txt" For Output As #1 ' Create a script to get the Netwash file to the current directory
    Print #1, "ftpIPAddress"
    Print #1, "Username"
    Print #1, "Password"
    Print #1, "cd dirname"
    Print #1, "cd additional Dirnames only if needed"
    Print #1, "get filename ""full path and file name to save EX C:\mydb.mdb"""
    Print #1, "quit"
    Close #1

    Call modulename("cmd /c ftp -s:""" & FilePath & "GetFile.txt""", vbNormalFocus)
    ______________________________________________

    Module Code
    ___________________________________________

    Dim proc As PROCESS_INFORMATION
    Dim Start As STARTUPINFO
    Dim ret&

    ' Initialize the STARTUPINFO structure:
    Start.cb = Len(Start)
    Start.dwFlags = 1
    Start.wShowWindow = iWindowStyle

    ' Start the shelled application:
    ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
    NORMAL_PRIORITY_CLASS, 0&, vbNullString, Start, proc)

    ' Wait for the shelled application to finish:
    ret& = WaitForSingleObject(proc.hProcess, INFINITE)
    Call GetExitCodeProcess(proc.hProcess, ret&)
    Call CloseHandle(proc.hThread)
    Call CloseHandle(proc.hProcess)
    ExecCmd = ret&

    _______________________________

    See if this helps
    Brent
    Last edited by bhummel; 12-04-03 at 14:19.

  3. #3
    Join Date
    Dec 2003
    Posts
    6

    cheers

    thanks for your time.... but am new to programing and im not sure what to do with this.

    i have put the code into the database. what do i need to do next. i have entered my details (ftp,user,pass etc) what is the getfile.txt. do i need to make this.

    im sorry, but as i said earlier, im a newbie.

    cheers lee.

  4. #4
    Join Date
    Nov 2003
    Location
    Warren, PA
    Posts
    52
    Once it is in the database all you need to do is run the code and it will create those files for you. Give it a try and let me know what happens and I will assist you through it

    Brent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •