?
Solved

Access VBA add Outlook attachment error

Posted on 2012-09-19
4
Medium Priority
?
875 Views
Last Modified: 2012-10-06
I have some VBA running behind a command button that when clicked takes some details from a query and sends an email containing this info, it also adds an attachment to the email.  The attachment is stored locally.  I cant see any reason why but this has now stopped working.  The error message i get is:

Run-time error'-2147024894 (80070002)2:
Cannot find this file.  Verify the path and file name are correct.

The error occurs on this line of code:

Set objOutlookAttach = .Attachments.Add("C:\test.doc")

Does anyone know why Access has suddenly stopped being able to find the file?
0
Comment
Question by:jdc1944
  • 2
  • 2
4 Comments
 
LVL 19

Assisted Solution

by:Ken Butters
Ken Butters earned 1500 total points
ID: 38414436
Can I assume correctly that C:\test.doc exists?

Are you running for first time on Windows 7 or Vista?  I'm wondering if this might be UAC (User Access Control) issue... where windows is preventing you from accessing the file at the root of the drive...

you could try accessing the file from your documents folder or somewhere similar to see if that is really the issue.
0
 
LVL 2

Accepted Solution

by:
jdc1944 earned 0 total points
ID: 38421294
We're not using Windows 7 or Vista.  I've moved the file around, renamed it and now it is working again after moving back to C: and keeping its original name.  Cant really think what may have caused it.
0
 
LVL 19

Expert Comment

by:Ken Butters
ID: 38421981
Ok... glad it is working for you.
0
 
LVL 2

Author Closing Comment

by:jdc1944
ID: 38469664
The issue resolved itself after renaming the file and moving the file around
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question