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 - Private Sub Command0_Click()
-
-
Dim Olapp As Outlook.Application
-
Dim Olmapi As Outlook.NameSpace
-
Dim Olfolder As Outlook.MAPIFolder
-
Dim OlMail As Object
-
Dim OlMessage As Outlook.MailItem
-
Dim OlItems As Outlook.Items
-
Dim OlRecips As Outlook.Recipients
-
Dim OlRecip As Outlook.Recipient
-
Dim db As DAO.Database, rst As DAO.Recordset
-
Dim flgSave As Boolean
-
Dim DQ As String
-
-
-
'Dim SubFolder As MAPIFolder
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("tbl_Mail", dbOpenDynaset) 'Open table tblMail
-
-
'Create a connection to outlook
-
Set Olapp = CreateObject("Outlook.Application")
-
Set Olmapi = Olapp.GetNamespace("MAPI")
-
-
'Open the PSC-EMEA inbox
-
-
Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox).Folders.Item("Mail Read")
-
Set OlItems = Olfolder.Items
-
-
For Each OlMail In OlItems
-
-
If OlMail.UnRead = True Then
-
-
rst.AddNew
-
rst!Date = OlMail.ReceivedTime
-
rst!Time = OlMail.ReceivedTime
-
rst!From = OlMail.SenderName
-
rst!Subject = OlMail.Subject
-
rst!Body = OlMail.Body
-
rst!CreationTime = OlMail.CreationTime
-
rst!LastModificationTime = OlMail.LastModificationTime
-
rst!Last_Checked = Now
-
rst.Update
-
-
OlMail.Delete
-
-
End If
-
Next OlMail
-
-
MsgBox "New mails have been updated. Please check the tbl_Mail details", vbOKOnly
-
-
'Release memory
-
Set Olapp = Nothing
-
Set Olmapi = Nothing
-
Set Olfolder = Nothing
-
Set OlItems = Nothing
-
Set OlMail = Nothing
-
Set OlMessage = Nothing
-
Set rst = Nothing
-
Set db = Nothing
-
-
End Sub
2 3636
Since u had put a question in the cafe .I am moving it to proper forum.
Please take care in the future regarding this
Hi
One or two things to try first:- - Set breakpoints in your code and use the debugger to determine where the errors are occurring;
- 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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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.
|
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...
|
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?
|
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...
| |
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...
|
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
|
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...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |