473,651 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access - Outlook Run Time Error

1 New Member
Hi all,
I am trying to move emails from Outlook into an Access table, the code below worked for me before, but now I am having a problem as this error message comes up: Run-time error 438 'Object doesn't support this property or method', for some emails is ok, but otherones, it just cant find the data of certain fields such as Received Time, From etc
Please if someone could help me with some advice.. Thankss

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3.     Dim Olapp As Outlook.Application
  4.     Dim Olmapi As Outlook.NameSpace
  5.     Dim Olfolder As Outlook.MAPIFolder
  6.     Dim OlMail As Object
  7.     Dim OlMessage As Outlook.MailItem
  8.     Dim OlItems As Outlook.Items
  9.     Dim OlRecips As Outlook.Recipients
  10.     Dim OlRecip As Outlook.Recipient
  11.     Dim db As DAO.Database, rst As DAO.Recordset
  12.     Dim flgSave As Boolean
  13.     Dim DQ As String
  14.  
  15.  
  16.     'Dim SubFolder As MAPIFolder
  17.     Set db = CurrentDb
  18.     Set rst = db.OpenRecordset("tbl_Mail", dbOpenDynaset) 'Open table tblMail
  19.  
  20.     'Create a connection to outlook
  21.     Set Olapp = CreateObject("Outlook.Application")
  22.     Set Olmapi = Olapp.GetNamespace("MAPI")
  23.  
  24.     'Open the PSC-EMEA inbox
  25.  
  26.     Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox).Folders.Item("Mail Read")
  27.     Set OlItems = Olfolder.Items
  28.  
  29.     For Each OlMail In OlItems
  30.  
  31.              If OlMail.UnRead = True Then
  32.  
  33.                         rst.AddNew
  34.                         rst!Date = OlMail.ReceivedTime
  35.                         rst!Time = OlMail.ReceivedTime
  36.                         rst!From = OlMail.SenderName
  37.                         rst!Subject = OlMail.Subject
  38.                         rst!Body = OlMail.Body
  39.                         rst!CreationTime = OlMail.CreationTime
  40.                         rst!LastModificationTime = OlMail.LastModificationTime
  41.                         rst!Last_Checked = Now
  42.                         rst.Update
  43.  
  44.                         OlMail.Delete
  45.  
  46.                 End If   
  47.    Next OlMail
  48.  
  49. MsgBox "New mails have been updated. Please check the tbl_Mail details", vbOKOnly
  50.  
  51.    'Release memory
  52.    Set Olapp = Nothing
  53.    Set Olmapi = Nothing
  54.    Set Olfolder = Nothing
  55.    Set OlItems = Nothing
  56.    Set OlMail = Nothing
  57.    Set OlMessage = Nothing
  58.    Set rst = Nothing
  59.    Set db = Nothing
  60.  
  61.    End Sub
Jun 6 '07 #1
2 3636
debasisdas
8,127 Recognized Expert Expert
Since u had put a question in the cafe .I am moving it to proper forum.

Please take care in the future regarding this
Jun 6 '07 #2
cyberdwarf
218 Recognized Expert New Member
Hi

One or two things to try first:-
  1. Set breakpoints in your code and use the debugger to determine where the errors are occurring;
  2. Runtime error 438 doesn't have anything to do with data, rather with invalid properties assigned to an object.
If you follow tip 1, you will soon find which objects are giving you the problem. At that stage, you can come back to the forum with some additional info.

HTH
Steve
Jun 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
12075
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to use PHP to get inside an OWA (Microsoft Outlook Web Access) website to send email that way? The reason I ask is because my corporate office is going to do away with our rogue SMTP server access and force everything through Exchange
4
4864
by: MLH | last post by:
I would like to configure OutLook Express so that it does not attempt to resend eMails in the Outbox folder whenever new sends are made From Access. The ISP's server rejects some eMail address immediately... Things like JohnDoe@aol. (an incomplete address) and sometimes NonExistent@NorthState.net (if NorthState is my ISP, its mail server knows IMMEDIATELY that NonExistent is NOT a valid mailbox in their system.
2
14912
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data in the format that I need it in order to create the reports that we use. So far this has proven to be successful for the reports that I am doing and the data that I am pulling into it. I just have one challenge that may require a lot of work and I...
2
4510
by: Salad | last post by:
A2003, WinXP I know it is possible to link the Outlook contacts table to Access. Is it possible to call/open the Outlook Contacts window form within Access?
4
3389
by: KnightKnives | last post by:
Is there anyone out there who could help me find the resources I need in order to make this application. I have done a lot of work with 2.0 engine then upgraded to 97; now have 2003. I have struggled with coding in VBA and know some VBA. Have bookkeeping degree but want to apply as much as I can with the limited knowledge that I have with VBA. Just some basics would help me. Also, I am new to this forum and new to using the net. I am...
3
2569
by: scott_baird | last post by:
I have an email macro setup (maybe I should go another way, but that was the quickest at the moment...) and what I would like to do is automate the "to" addressee of the email it generates for sending. What I have is an email button that creates a report based on a property address on a form (driven by a query which has criteria such as forms!frmPROPERTY!address). That open form also has an email address on it for the owner, and I would...
5
2966
by: horsetransport | last post by:
Hello, Below is what I "Know how to do" but it doesn't accomplish what I want I have table called sndmail fields that matter useremail and mailsent
1
2165
by: ARC | last post by:
Ok, now I'm stuck!! I've been having blue screens a lot whenever I do any serious development in Access 97. I don't get this in 2000, and am currently migrating towards Access 2007. I found an ariticle on Microsoft's site saying that if you have 2 versions of full MS Outlook on your machine, it could cause instability. I had Outlook 97 and Outlook 2000 on my machine. So, I uninstalled Outlook 97. Big mistake!! Now, in my other access 97...
2
2440
by: jrworsham | last post by:
Please help! I have an Outlook module opening a connection to Access, writing in some data, and then pulling out some data. But for some reason the code only works the first time and after that you have to close outlook and reopen it for it to work. After you run the code you can not even open the Access database until you close Outlook. I suspected it was a problem with the connection not being closed, or closed correctily, but I have tried...
0
8361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8701
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.