Computer Learning Zone CLZ Access Excel Word Windows

Science is based on experiment, on a willingness to challenge old dogma, on an openness to see the universe as it really is. Accordingly, science sometimes requires courage - at the very least the courage to question the conventional wisdom.

-Carl Sagan
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Microsoft Access Email Seminar    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Read Email in Outlook
Michael Flanagan 
      
5 years ago
Using the following code:

Dim oApp As Outlook.Application
    Dim oNS As Outlook.NameSpace
    Dim oInbox As Outlook.MAPIFolder
    Dim oCompleted As Outlook.MAPIFolder
    Dim oMailItem As Outlook.MailItem
    Dim DB As Database
    Dim RS As Recordset
    Dim X As Long, Y As Long
    
    Set oApp = New Outlook.Application
    Set oNS = oApp.GetNamespace("MAPI")
    Set oInbox = oNS.GetDefaultFolder(olFolderInbox)
    'Set oCompleted = oInbox.Folders("Completed")
    
    Set DB = CurrentDb()
    Set RS = DB.OpenRecordset("IncomingT", dbOpenDynaset)
    
    For Each oMailItem In oInbox.Items
      MsgBox oMailItem.Subject
    Next



I get a type mismatch error where oMilItem is set to nothing.

Any ideas on how to fix this?
Richard Rost  @Reply  
           
5 years ago
Is that code directly from the course, or did you modify it? It's been several years since I recorded that class, so I don't remember. Do you have any mail items actually in your inbox?
Michael Flanagan OP  @Reply  
      
5 years ago
The code is from the course.  I did get several records into the IncomingT table, but my Outlook inbox (via Gmail) has over 9,000 emails.  It seems to limit the number of records I can retrieve and now will not add any new records to the table.  I get the type mismatch error where the oMailItem is now null.
Richard Rost  @Reply  
           
5 years ago
I can't recreate the error. I use the same code in my database to pull customer service emails from Outlook into Access. Never a problem. Can you post some screen shots?

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

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 12:33:05 PM. PLT: 0s