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

Button/Code to Open Excel works on Access 2000 but not "003

Status
Not open for further replies.

psbrown

MIS
Oct 16, 2001
40
Hi I have a button on an acess form that runs the code below, this has been happily working on access/excel 2000 for some time. We have just upgraded to access/excel 2003 and it is failing at the code marked ***** Failing Below Here.

I have done the usual searches and cannot find anything, any help/guidance would be much appreciated.

Paul

Private Sub CmdMAccInc_Click()
On Error GoTo ErrorHandler

Dim strCurDir As String

'Find Current Directory
strCurDir = CurrentDb.Name
strCurDir = Left(strCurDir, Len(strCurDir) - Len(Dir(strCurDir)))

MsgBox "here"
MsgBox strCurDir

****** Failing Below Here
'Update spreadsheet with Query Data
DoCmd.TransferSpreadsheet acExport, 8, "qryMOIncident", strCurDir & "\MoIncident.xls", True



'Open Spreadsheet and allow user to ammend and save as required.
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open (strCurDir & "MoIncident.xls")

Exit Sub

ErrorHandler:
MsgBox "Please ensure that you have not already got MoIncident.xls open"

End Sub
 
Which error message when the On error instruction is commented out ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the response PHV

The error message is run-time error '2220'

microsoft access cannot open the file
'H:\SafetyAuditDB\MoInciden.xls'

Paul
 
Seems like a permissions issue.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I dont know why, I am an Administrator, H is my personal drive and it works with access 2000.

Are there pemission functions with access 2003?

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top