Results 1 to 2 of 2
  1. #1
    ratherbgolfing is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    1

    Red face User Prompt for multiple Files

    I have code that exports queries and appends the current date to the file name. What I need is instead of the current date I need to prompt the user once for a date then insert that date into each function. I have several individual functions that run the same process but use different filenames and paths to save the files. All I need is to append the file name with whatever date the user inputs. Any help would be great!!! Below is my current code for one export function.

    Public Function ASM()

    Dim Current_Date As String

    Dim File_Name As String

    Current_Date = Format$(Now(), "yyyy\-mm\-dd")

    File_Name = "G:/JV/ASM-" + Current_Date + ".txt"

    DoCmd.TransferText acExportDelim, "ASM Export Spec", "ASM", [File_Name]

    End Function

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Why 4 separate Functions (and not Subs)? If you always run these 4 exports every time, can they all be in one Sub?

    You can use an InputBox function, something like:
    Code:
                     
             Current_Date = InputBox("Enter date.", "Date Input", Date())
             If Current_Date = vbCancel Then
                   'do nothing, user canceled procedure
             ElseIf Not IsDate(Current_Date) Then
                   MsgBox "Not an appropriate entry. Procedure canceled.", "Entry Error" 
             Else
                   File_Name = "G:/JV/ASM-" + Current_Date + ".txt"
                   DoCmd.TransferText acExportDelim, "ASM Export Spec", "ASM", [File_Name]
                   'and the other 3 exports as well?
             End If
    Or have user input to a textbox on form and refer to the control for the criteria.
    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. Prompt User for Date Range when running QUERY
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-30-2012, 11:49 AM
  2. User importing of image files
    By avarusbrightfyre in forum Import/Export Data
    Replies: 1
    Last Post: 10-28-2011, 03:49 PM
  3. Replies: 13
    Last Post: 07-27-2011, 12:38 PM
  4. Replies: 4
    Last Post: 06-14-2011, 07:19 PM
  5. Replies: 2
    Last Post: 05-25-2010, 02:45 PM

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