Computer Learning Zone CLZ Access Excel Word Windows

I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.

-Bill Gates
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Seminars > Email > Lessons >
Back to Email Seminar Lessons    Comments List
Cancel Select File Error Upload Images   Link   Email  
Amanda McDonald       
4 months ago
On the email form When one of the attach buttons is clicked the Windows browser opens if cancel is pressed instead of selecting a file and then the Send Via Outlook button is clicked I get this error:

Run-time error '-2147024893 (80070003)':
Path does not exist. Verify path is correct.

In the sample database, EmailSeminar-NEW, I got the same error.

I tried adding On Error Resume Next but now I get this error:

Run-time error '-2147352567 (80020009)':
Array index out of bounds.

I'm out of my league with this, any help would be appreciated.
Amanda McDonald       
4 months ago

Amanda McDonald       
4 months ago

Amanda McDonald       
4 months ago

Amanda McDonald       
4 months ago

Richard Rost              
4 months ago
Is your attachments folder correct? HINT: Is your name Richard?
Richard Rost              
4 months ago
And yeah, cancel will generate that error. I don't think I trapped it. A simple On Error... will fix that.
Amanda McDonald       
4 months ago
I tried adding On Error and got a new error.

Run-time error '-2147352567 (80020009)':
Array index out of bounds.

Am I putting the on error in the wrong place?
Amanda McDonald       
4 months ago

Kevin Robertson            
4 months ago
I just downloaded the database file and it worked perfectly for me without any errors.
Have you made any changes to Richard's code?

Also the On Error Resume Next would need to be in the PickFile sub in the Module (which is already in place).

Did you click the Debug button to see which line was actually throwing the error?
Amanda McDonald       
4 months ago
No, I haven't changed any of the code in his db. Yes, I debugged, I tried to post screenshots of everything but some of them didn't post. I'll try to explain it better.

Everything works fine...unless I click either of the attach buttons on the email form <I>and then</I> click <B>Cancel</B> in the file select window without selecting a file. <I>And then</I> click the Send Via Outlook button on the email form.
That gives me this error:
Run-time error '-2147024893 (80070003)':
Path does not exist. Verify path is correct.


Which debugs to one of these two lines, depending on which attach button was canceled.
OMsg.Attachments.Add (MsgAttach1)
OMsg.Attachments.Add (MsgAttach2)

That is why I tried adding the On Error for those blocks of code. But with the On Error where I have it in the picture above I get this error.
Run-time error '-2147352567 (80020009)':
Array index out of bounds.
Richard Rost              
4 months ago
Path does not exist. What does that tell you?

I'll repeat what I asked you earlier...

Is your attachments folder correct? HINT: Is your name Richard?

Take a look at the screenshots you posted. What is your path?
Sami Shamma              
4 months ago

Richard Rost              
4 months ago
Shhhh... I'm trying to have a "teaching moment" 😁
Sami Shamma              
4 months ago
Soooorrryyyy
Richard Rost              
4 months ago
Haha. You're good. Thanks! :)
Amanda McDonald       
4 months ago
It does the same thing in my DB. And it still does it in the class DB when I change the folder path.

The only thing different is I took the Attach Folder field off my form and instead put the path in the PickFile code.

In both DB's I tried using the path  "Z:\Attachments\" instead of "Z:\Attachments" and I still got the same error.

I learn by doing, so I don't usually open the class DBs. I build my own DBs along with you in your seminars.
I ran into the error when testing my DB. I re-wound, re-watched, and went over everything multiple times.
Couldn't figure it out, decided to open the class DB to compare the code, sure it was something simple.
But ran into the error in the class DB too.
Amanda McDonald       
4 months ago

Amanda McDonald       
4 months ago

Richard Rost              
4 months ago
OK... let's see what it's trying to use. Right before that line that's generating the error, put:

MsgBox MsgAttach1

This will let us see what it's trying to use.
Amanda McDonald       
4 months ago
It's emplty.
Amanda McDonald       
4 months ago

Richard Rost              
4 months ago
Well there's your problem. Now trace it back and find out where it's getting it's value from. MsgBox it each step of the way. Make sure you have the field name spelled right on the form. Check what PickFile is returning, etc.
Kevin Robertson            
4 months ago
Amanda,

Modify the block of code as below (also checking for an empty string):

    If Not IsNull(MsgAttach1) And MsgAttach1 <> "" Then
        If Dir(MsgAttach1) = "" Then
            MsgBox "Attachment 1 does not exist"
        Else
            OMsg.Attachments.Add (MsgAttach1)
        End If
    End If
    
    If Not IsNull(MsgAttach2) And MsgAttach2 <> "" Then
        If Dir(MsgAttach2) = "" Then
            MsgBox "Attachment 2 does not exist"
        Else
            OMsg.Attachments.Add (MsgAttach2)
        End If
    End If
Amanda McDonald       
4 months ago
I am missing something, I thought it should be empty since I am clicking cancel instead of selecting a file. What should populate in the MsgBox when I hit cancel?
Richard Rost              
4 months ago
If you hit cancel that should return an empty string, which means you haven't picked a file. The system WILL give you an error then if you don't trap it and exit.
Amanda McDonald       
4 months ago
Thank you Kevin that worked like a charm! Thanks for sticking with me Richard.
It didn't click for me that the cancel button was returning an empty string until Keven posted his code and said to check for one.
I feel like I learned this lesson the hard way, and drug ya all through the mud with me.
Thank you!!!
Richard Rost              
4 months ago
That's what you're here for: to learn this stuff, and honestly, the best way to learn is to struggle with something for a while because now you won't make that mistake again.
Sami Shamma              
4 months ago
Good for you, Amanda. You stuck with it until you got it.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Email Seminar Lessons.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/23/2024 3:04:11 AM. PLT: 1s