Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export using a parameter value

Status
Not open for further replies.

strangeryet

Programmer
Jul 8, 2004
159
US
I want to export the results of a query to a text file, however the query works off a parameter.
How do I feed the line below the parameter?

DoCmd.TransferText acExportFixed, , "qryBreakDownToIndividualRecords", _
"C:\400\NieExport.txt", False, ""

The query looks like this:
SELECT [@RunDate], StartStopDate, RoutNum, 'Mon' AS DayName, NumOfPapers, PermiAction, FunctionADR
FROM tblInput
WHERE Mon = True;


Thanks
 
strangeryet,
Microsoft: Access Modules (VBA Coding)?

At any rate, create a function that returns RunDate and use it in your query?
Code:
Public Function Get_RunDate() As Date
Get_RunDate = [i]YourRunDate[/i]
End Function

[tt]SELECT Get_RunDate, StartStopDate, RoutNum, 'Mon' AS DayName, NumOfPapers, PermiAction, FunctionADR
FROM tblInput
WHERE Mon = True;[/tt]

If [tt]Get_RunDate[/tt] resides in the same module as your [tt]DoCmd[/tt] statement you could set [tt]YourRunDate[/tt] as a global variable that is updated before the query is run.

Hope this helps,
CMP

P.S. If you need the parameter prompt to show up when a user opens the query you could add the code to [tt]Get_RunDate[/tt] that prompts for a date if [tt]YourRunDate[/tt] is not set. CMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top