Run time Error 2220

D

Denver

Hello,

I have a cmdExportthisExcel with this code

Dim strSql As String

strSql = "SELECT* FROM [DCN01]"
With Me.[Data_Entry2_subform].Form
If .FilterOn Then
strSql = strSql & " WHERE " & .Filter
End If
End With
Debug.Print SQL
strSql = strSql & " ORDER BY [Drawing Ref];"
CurrentDb.QueryDefs("qryExport").SQL = strSql
DoCmd.TransferSpreadsheet acExport, 8, "qryExport", _
"D:\"

i want this code to export to excel what i have filtered in my subform.

the problem is i have this Run time Error 2220: Eng'g Database can't open
the file 'D:\'.

is there anyone is kind to help me to fix this code?
or what else do i miss in my codes?
i've been using this path "D:\" to some of my database function when exporting
but now i can't open it.
i doubt there is something wrong with my codes specially my codes
DoCmd.TransferSpreadsheet acExport, 8, "qryExport", _
"D:\"
i think i miss some arguments here?
can anyone help me witht this?

thanks for any help.
 
D

Denver

thanks Chris O'C it really works now..

Chris O'C via AccessMonster.com said:
Make this change:

DoCmd.TransferSpreadsheet acExport, 8, "qryExport", _
"D:\Iforgotthefilename.xls"


Chris
Microsoft MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top