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!

xp_sendmail: Access to the attachement file(s) is denied

Status
Not open for further replies.

sixteamparlay

IS-IT--Management
Aug 1, 2008
46
US
I recently updated a box from windows 2000 to windows vista and the same access .adp which ran on 2000 gives the error
"xp_sendmail: Access to the attachement file(s) is denied" although the user has the ability to both create and delete the .xls file. Has anyone experienced similar probs after upgrading to vista?


DoCmd.OutputTo acOutputStoredProcedure, str, acFormatXLS, stFileName, False


--------- the statement before this line runs correctly
Conn.Execute "execute spEmailReports @EmailAddress = '" & Me.txtEmailTo & _
"', @ReportName = '" & stFileName & _
"', @ReportTitle = '" & RptSubject & _
"', @ReportMessage = '" & RptMessage & "'"
--------- the statements after this line run correctly

'Delete the Excel file when done.
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
objFileSystem.DeleteFile (stFileName)
Set objFileSystem = Nothing
 
Remember that the actual execution of the stored procedure happens under the context of the SQL Server service account (not the user logged into the workstation). You need to ensure that the permissions are set so that this can access the folder in which the file exists.

You can check this by logging into SQL Server as the same SQL account that your application connects as, then running something like:

Code:
exec xp_fileexist 'c:\yourfile.rpt'

using the same path and filename as your application calls.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top