I hope someone can really help me with resolving this problem.
Initially, I was having a runtime error 2302, "can't save file to the output selected", with the following code:
Then someone suggested to change the code to transferspreadsheet..., and I changed the code to:
But with this code I am having error 3501 or something like that and it says the file is already open or I don't have permission to open the file.
The funny thing is, both of these codes work perfectly on another computer. Both computers have the same access and excel version.
What could I do to fix this. Please try to explain in detail.
Thanks.
Initially, I was having a runtime error 2302, "can't save file to the output selected", with the following code:
Code:
Private Sub Export_Click()
If IsNull(Me.CustNo2) Then
MsgBox "You must have a valid Ship to Customer Number above", vbCritical, "Selection Error"
CustNo2.SetFocus
Else
DoCmd.OutputTo acQuery, "CustNo2Details", "MicrosoftExcel(*.xls)", "c:\ Customer Details.xls", True, ""
End If
End Sub
Then someone suggested to change the code to transferspreadsheet..., and I changed the code to:
Code:
Private Sub Export_Click()
If IsNull(Me.CustNo2) Then
MsgBox "You must have a valid Ship to Customer Number above", vbCritical, "Selection Error"
CustNo2.SetFocus
Else
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "CustNo2Details", "C:\CustomerDetails.xls", False
Application.FollowHyperlink "C:\Customer Details.xls"
End If
End Sub
But with this code I am having error 3501 or something like that and it says the file is already open or I don't have permission to open the file.
The funny thing is, both of these codes work perfectly on another computer. Both computers have the same access and excel version.
What could I do to fix this. Please try to explain in detail.
Thanks.