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

MS export, cannot find file

Status
Not open for further replies.

mayhem11

Technical User
Jan 9, 2012
10
US
I am trying to export a query to .xlsx and I have the file in mydocuments and I get cannot find file error. Do I need to not name the file and just allow the end-user to select the file name instead?

Here is my code:
Code:
Private Sub cmdExcel_Click()
DoCmd.OutputTo acOutputQuery, "qryA", acFormatXLSX, "C:\qryA.xlsx", , , , acExportQualityPrint
End Sub

Maybe I should be doing this?
Code:
Private Sub cmdExcel_Click()
DoCmd.OutputTo acOutputQuery, "qryA", acFormatXLSX, "C:\.xlsx", , , , acExportQualityPrint
End Sub
 
You say: "I have the file in mydocuments " yet you look for "[tt]C:\qryA.xlsx[/tt]"

So, where is the file you want to use?
Do you have a file named [tt]qryA.xlsx[/tt] straigh on your [tt]C:\[/tt] drive?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top