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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transfertext on a query 1

Status
Not open for further replies.

snowmantle

Programmer
Jun 20, 2005
70
GB
Hi,

I am doing this at the moment in my .adp file.

Code:
DoCmd.TransferText acExportDelim, , "QryExportAll", "P:\Export\Data" & Format(Now(), "mmddyyyy") & ".csv"

The view "QryExportAll" exists in the sql server database in the above case.

When trying to run it i get a runtime error '7874' Microsoft Access can't find the object 'QryExportAll.'

I have a report that uses another query that works fine.

Anyone know why this doesnt work??

I am going to be changing the .adp to a .ade after this change has been made so it needs to work for that as well.
 
I figured another way of doing what i wanted with .adp.

This was for exporting report results that have been filtered.

Code:
DoCmd.OutputTo acOutputReport, "ReportName", acFormatXLS, "P:\Export\Data" & Format(Now(), "mmddyyyy") & Format(Time(), "hhmmss") & ".csv", True
DoCmd.Close acReport, "ReportName"

This way i use the above code after opening the report with the sql filter from Access.

Export the results to excel and close the report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top