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

Email from Access; Attatchment from another Drive 2

Status
Not open for further replies.

zoroaster

Programmer
Jun 10, 2003
131
GB
I've been using the code from FAQ.702-2921 with much success until I came up against this problem:
The Access database which fires off the email is on 'G:\' drive, whilst the object I wish to programmatically attach to the email is on 'X:\' drive,
When I run the code I'm getting a Microsoft Access dialogue box which states: 'The system could not find the path specified' I have permissions to both drives. I've tried changing the code to look at an object on the 'G:\' drive, and the code attaches it just fine - anyone know why this behaviour should be, and what to do to get around it?

Briefly, here is the code again:
Code:
Dim email As String, ref As String
Dim notes As String
Dim objOutLook As Object
Dim objEmail As Object
Set objOutLook = CreateObject("OutLook.Application")
Set objEmail = objOutLook.CreateItem(olMailItem)

ref = "Subject Line"
email = "A.N.Other@SomeAddress"
notes = "Hello A..."

With objEmail
.To = email
.Subject = ref
.Body = notes
.Attachments.Add ("X:\somefolder\somefolder\somefile.xls") 'add attachment
.Display
End With





Laters, Z

"42??? We're going to get lynched!
 
Have you tried using the full Server\path name instead of the drive letter mapping ?

Eg.

.Attachments.Add ("\\Server\somefolder\somefolder\somefile.xls") 'add attachment




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Good point LittleSmudge!
However, I've just tried this, but without success - I'm not sure if I'm using the right syntax for the server name - in 'My Computer' the 'X' drive is displayed as:
RdP on 'Corpfp2'(X:)
How should I declare the path to the server correctly?

Laters, Z

"42??? We're going to get lynched!
 
Run Windows Expolorer ( Hold Windows key down and press E )

Make sure that WinExplorer is set up to show Full path in Address Bar ( Tools, Folder Option )

Then navigate via MyNetworkPlaces and find the server that has CorpF2p within it.

Depending on your set up you might find it lower that the top level.

Once selected you'll see the full \\server\path\folder in the address bar.

You are looking for something of the form

\\servername\pathname\foldername .. .. etc

or

\\123.456.789.123\pathname\foldername .. .. etc




'ope-that-'elps.





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
If you open up My Computer, go to Tools->Map Network Drive..
a box will pop up. In the Drive: ComboBox there will be a list of all drives and any associated network paths there.

HTH,
Mike
 
Hey - thats an easier approach Mike.

Good one.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Bonza!

That's done the trick, ('\\Corpfp2\Rdp\folder\folder\file')

Wonderful, thankyou both!

Laters, Z

"42??? We're going to get lynched!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top