Hello!
I have developed a VBA procedure to export a number of queries as a text (comma delimitted) to a specific folder. However, I have ran into a snag as one of the queries requires the user to input the date of the Monday of the current week. For example, if we use the current week we are in (09/09/2013 - 09/13/2013: 5 day business week). Let's say the user runs the code on Monday, 09/09/2013. Then the user needs to input two parameters in two seperate instances, one after the other. First they would enter the month: "09". Then they would enter the day: "09". After they input these two parameters, the query will run. If the user runs the report on a Tuesday (date in this instance would be 09/10/2013), then I still need the two parameters to be, Month: "09", Day: "09". This holds true if the query is ran on a Wednesday (parameters still would be 09/09). The code I current have works great for queries that do not need users to enter a parameter, and the current code is the following:
Code:
Sub Export_Queries()
Dim OutputPath As String
Dim strQryName1 As String
Dim strXLFile1 As String
OutputPath = "C:\"
strQryName1 = "Query1"
strXLFile1 = OutputPath & "Query1" & ".txt"
DoCmd.TransferText acExportDelim, "Query1_Export", strQryName1, strXLFile1, True
End Sub
What I need is the following:
* Code that will input the correct parameter dates for the Monday of the current week (please see explanation above).
* The code needs to be implemented in the code I have above.
Please let me know if you need any additional information! Thank you for all of your help!