By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,786 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,786 IT Pros & Developers. It's quick & easy.

Receive Email Using Ms-Access and Outlook

P: 35
Hai.
I needto Receive Email using Ms-Access and Outlook.

On the receiving end, the user receives the email at the Outlook. When they opens the Email, the message box should have a button called “Save to Access”.

When this button is pressed, a dialog box should pop up where the user can choose a contact name and a job name and click on SAVE


Here contact name and job name are in the access table fields. We go to select any one contact and any one job for the particular Email. Then the Email details are stored into a Access table.

There anybody help me for this...

Thanks
Tamilvanan
Apr 10 '07 #1
Share this Question
Share on Google+
6 Replies


Rabbit
Expert Mod 10K+
P: 12,359
Hai.
I needto Receive Email using Ms-Access and Outlook.

On the receiving end, the user receives the email at the Outlook. When they opens the Email, the message box should have a button called “Save to Access”.

When this button is pressed, a dialog box should pop up where the user can choose a contact name and a job name and click on SAVE


Here contact name and job name are in the access table fields. We go to select any one contact and any one job for the particular Email. Then the Email details are stored into a Access table.

There anybody help me for this...

Thanks
Tamilvanan
What code have you tried so far?
Apr 10 '07 #2

ADezii
Expert 5K+
P: 8,627
Hai.
I needto Receive Email using Ms-Access and Outlook.

On the receiving end, the user receives the email at the Outlook. When they opens the Email, the message box should have a button called “Save to Access”.

When this button is pressed, a dialog box should pop up where the user can choose a contact name and a job name and click on SAVE


Here contact name and job name are in the access table fields. We go to select any one contact and any one job for the particular Email. Then the Email details are stored into a Access table.

There anybody help me for this...

Thanks
Tamilvanan
You would need to create Automation code in Outlook in order to establish communications betwen the 2 Applications - not an easy task.
Apr 10 '07 #3

pks00
Expert 100+
P: 280
Hi TamilVanan, personally I wouldnt keep prompting for each email received, it would be a right pain in the **** at times. Why dont u just customize the toolbar to run your macro?

Code itself is pretty straight forward, not much difficulty there
A number of ways to do it, here is one simple method.

Expand|Select|Wrap|Line Numbers
  1. Public Function SaveToAccess()
  2.  
  3.     Dim sContactName As String
  4.     Dim sJobName As String
  5.     Dim db As DAO.Database
  6.     Dim rs As DAO.Recordset
  7.  
  8.  
  9.     sContactName = InputBox("Enter Contact Name")
  10.     sJobName = InputBox("Enter Job Name")
  11.  
  12.     If sContactName = "" Or sJobName = "" Then
  13.         MsgBox "Listen, please try to enter both a contact and job!!!"
  14.         Exit Function
  15.     End If
  16.  
  17.     Set db = DBEngine(0).OpenDatabase("C:\TSDN\TSDN.mdb")
  18.     Set rs = db.OpenRecordset("tblStuff")
  19.     rs.AddNew
  20.     rs!ContactName = sContactName
  21.     rs!JobName = sJobName
  22.     rs.Update
  23.     rs.Close
  24.     Set rs = Nothing
  25. End Function
  26.  

to use DAO, u would need to add the reference to Microsoft DAO Object Library v3.6


other method, u could create access objects then issue a DoCmd.RunSQL command, just as easy except users need permissions to create objects
and of course the alternative to DAO is to use ADO
Apr 10 '07 #4

P: 35
What code have you tried so far?

Hai. Am using the following code only for display the Content of mail in Access Form. But the Receive mails are got from Inbox folder at Outlook.

Private Sub Command0_Click()
command0 and a text field called text1
Dim objApp As Outlook.Application
Dim objItem As Outlook.MailItem
Dim SndName As String, SndAddr As String, ToName As String, CCName As String
Dim Subj As String, Rcvd As String, MsgBody As String, AtchName As String
Set objApp = New Outlook.Application
'For Each objItem In objApp.ActiveExplorer.Selection
For Each objItem In objApp.ActiveExplorer.Selection
If objItem.Class = olMail Then
With objItem
SndName = .SenderName
SndAddr = .SenderEmailAddress
ToName = .To
CCName = .CC
Subj = .Subject
MsgBody = .Body
Rcvd = .ReceivedTime

End With
End If
Next

Me.Text1 = MsgBody
Set objItem = Nothing
Set objApp = Nothing
End Sub


But i need,

On the receiving end(Outlook), the user receives the email at the Outlook. When they opens the Email at Outlook, the message box should have a button called “Save to Access”.

When this button is pressed, a dialog box should pop up where the user can choose a contact name and a job name and click on SAVE

Here contact name and job name are two tables that already there in the access Application. We go to select any one contact and any one job for the particular Email. Then the Email details are stored into a Access table.


If u know how to do the functionalities, plese let me know.

Thanks
Tamilvanan
Apr 11 '07 #5

Rabbit
Expert Mod 10K+
P: 12,359
As a start, the same way you Dim the Outlook application, you can do the same for an Access application and then open a database.
Apr 11 '07 #6

pks00
Expert 100+
P: 280
From that code, what is it u want to store?
the example code Ive given shows u how u can add values to ms access

I am using prompts for contact and job, u can substitute this with other values
Apr 11 '07 #7

Post your reply

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