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

Question using Outlook reference / Access 98

Status
Not open for further replies.

Toga

Technical User
Jul 21, 2000
234
US
I have a scheduled task set up to open an access app, run a query and send excel file each morning. Actually works great but I am havng a problem the first time this code runs after booting the computer where it does not send the attached excel file in a readable excel file format. After that it runs great each day.....as long as I don't reboot the computer for some reason.

The email sends fine....it's just the attached file that can't be read. Is there something else I should be doing with the code to prevent this issue. Seems like there's something else I need to be initializing b4 sending that attachment.

My code below.

Again....it's only the very first time after booting the computer.....after that, it works fine.


With MailOutLook
.To "email@someaddress"
.Subject = "My Subject Line"
.Attachments.Add "Path to excel file"
.Send
End With

Many thanks...Toga
 
You don't mention if the excel file is stored on a network drive. Perhaps when you reboot, the scheduled task is trying to run and your network drives aren't completely mapped yet and so it doesn't find the correct file?

Just a wild guess on my part!

HTH

Leslie
 
Yes, it is a network drive. I don't think that's it because the file is created first in my access app....then saved to the network location....and then attached to the email. The file that's created is fine. It's like a 30 kb that's stored on the network but only a 4 kb file that get's sent.... When you try to read the attached file.....you get an error message that the operation failed.

After that first time sending a bad file.....the program works great each time after that.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top