Results 1 to 5 of 5
  1. #1
    Datament is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2023
    Posts
    39

    Export file to specified folder 📂in a path, but if folder does not exist save file to "TEMPFolder"

    Hello, I have a situation whereby when I click btn_Finished I need to export "Statement_file" to one of the existing subfolders with "USERS" names "fld_Abi", "fld_Clint", "fld_Dell", "fld_Many", "fld_More" and "fld_TEMPFolder"(Not assigned to any user). All the subfolders are in a folder "FLD_ReportPickup" and are all named after each user except the "fld_TEMPFolder" which is to be used only when a user name is not setup or does not exist in the folder "FLD_ReportPickup".



    This is what I currently have:

    Dim User As String
    Dim TempDAPath
    Dim DAPath

    If User = "" Or IsNull(User) Then
    User = "fld_TEMPFolder"

    DAPath = "W:\Service Center\Reports\Dealerships\DealershipsONLY\Processors" (Statement_file is correctly autosaved here in the "Processors" subfolder)

    TempDAPath = "W:\Service Center\Reports\Dealerships\DealershipsONLY\Process ors\FLD_ReportPickup" & User & "
    (Statement_file is NOT saving in any user's subfolder or in the "fld_TempFolder")

    Please correct me, what am I doing wrong? I need the btn_Finished to save Statement_File to respective USER's subfolder, and in the case of a new user that has not been setup, or a subfolder that does not exist saved in "fld_TEMPFolder".

    End If

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Take a look at FSO and all the methods associated with it. https://learn.microsoft.com/en-us/of...mobject-object

    You could just test if a folder exists for a user and if not, create it, and then save the file to it.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If Dir(TempDAPath) = "" Then MkDir TempDAPath (or whatever action you want to take)

    Assumes every folder above User folder already exists.

    Is FLD_ReportPickup supposed to be a folder above user folder?
    Last edited by June7; 06-09-2024 at 09:10 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Datament is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2023
    Posts
    39
    Thanks for your response and question:

    Is
    FLD_ReportPickup supposed to be a folder above user folder? YES
    W:\Service Center\Reports\Dealerships\DealershipsONLY\Process ors\FLD_ReportPickup\fld__Abi, fld_Clint, fld_TempFolder.......

    And fld_TempFolder already exists in the fld_ReportPickup folder for the purpose of saving files by users not yet set up. So, there wouldn't be a need to create another folder but to detour the file to fld_TEMPFolder when a new user's folder is not found.

    Again THANKS for your assistance

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Did you try If Then statement I suggested?

    Why not create folder instead of saving to temp folder?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 28
    Last Post: 03-23-2021, 11:02 AM
  2. "Could not find file <file path." - Error 3024
    By jmitchelldueck in forum Access
    Replies: 4
    Last Post: 07-30-2015, 02:15 PM
  3. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  4. Replies: 21
    Last Post: 08-20-2012, 11:59 PM
  5. Replies: 2
    Last Post: 05-25-2012, 07:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums