Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169

    How to create a Outlook task or caledar reminder from Access

    I've searched the forums for this but I cant find anything specific on what I need to do. I have a contact db and I want to be able to create a simple Outlook task or calendar reminder item using data from just a couple of fields in a subform. For example: I click on the details for a contact, set a date in a date field, and have some sort of code attached to a command button that will auto-create an outlook task or calendar reminder based on the date in that field along with data from other misc fields in the contact's record. Hope that makes since.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I searched this forum for: outlook calendar

    Here is one https://www.accessforums.net/showthr...utlook-Calenda
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    Phew! As always you give me EXACTLY what I need to know. Thanks! One more item..... What if I want to add an attachment to a calendar invite? I assume it would be similar to what I currently have on an email form you helped me with, that has one line that looks like this:

    If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
    .Attachments.Add (Me.Mail_Attachment_Path)
    End If

    ....BUT I'm now using an attachment link in the db itself, which allows me to attach external files directly to the individual records in my table. I wondered if there was a way to have the script pull from that 'attachments' field in my table.

    Would it be something like this?

    .Attachments.Add (Me.Attachments)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Pulling file from attachment field is not easy. Far as I can tell it requires saving the files out to a folder and then grabbing from the folder.

    Review http://blogs.office.com/b/microsoft-...cess-2007.aspx

    Also, search this forum for threads by aspen. Several of them are on this specific issue.

    I don't even know if file can be attached to a calendar item, either manually or programmatically.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    cool. While I look into this option, which will also be helpfull at least for my email form.....would you know how to implement it for a folder like you said? I imagine I could get it to work that way by creating a field with the filename(s) of the files I need added.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Not following - implement what for a folder?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    well you said "files out to a folder and then grabbing from the folder" ...I thought you meant you could do that as a alternative to pulling the files from the attachments field. If so, how would you suggest it?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    The second link I referenced in post 4 has code for extracting files from attachment field and saving to a folder location. Then code creating the Outlook item would grab appropriate file from the folder location as attachment, assuming files can be attached to an Outlook item. I have no idea about that part.

    Is that the implementation you are asking about?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    yes...sorry I misuderstood you at first. I understand now. I will check it out.

  10. #10
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    I was able to find this on another forum, which should suit my purposes I believe. Still appears that the copy needs to be copied to a temp folder on the hdd before it can attach it to an email form, but the code below deletes the file after it sends the email. Would you be able to help me incorporate the suggested code into my 'send email' code? The post below was pretty old so I wasnt sure how quickly I would get a response.

    Suggested code:

    i just wrote this little function for you this will save your Attachment on your harddrive.

    Dim db As DAO.Database
    Dim rst As DAO.Recordset2
    Dim rstAttachment As DAO.Recordset2
    Dim fld As DAO.Field2
    Dim strPath As String
    Dim intz As Integer


    Set db = CurrentDb
    Set rst = db.OpenRecordset("tabelle1", dbOpenDynaset)
    rst.FindFirst "ID = " & Me!ID

    Set rstAttachment = rst.Fields("Feld1").Value
    Set fld = rstAttachment.Fields("Filedata")
    strPath = CurrentProject.Path & "\" _
    & rstAttachment.Fields("Filename")
    On Error Resume Next
    Kill strPath
    On Error GoTo 0

    fld.SaveToFile strPath

    rstAttachment.Close
    rst.Close
    Set rstAttachment = Nothing
    Set rst = Nothing
    Set db = Nothing



    You can add the mailcode to it and use strPath in the AttachmentAdd-Statement. And at the end you can use kill to delete the attachment. when the mail was send.

    _______________________________

    My 'Send Email' Code:

    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = "email address"
    .CC = "email addresss"
    .Subject = "test"
    .HTMLBody = "test"
    .Attachments.Add " "
    'Send email
    '.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
    .Send
    End With
    'MsgBox MailOutLook.Body
    Exit Sub
    email_error:
    MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
    Resume Error_out
    Error_out:
    End Sub

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    How shall I help? I don't know your data or forms or processes. What event do you want to trigger this - a button click? How will you identify the file needed for the email? User selection from a listbox of the attachment field or do you want to attach all the files from that record? If you want multiple files attached to email, need looping code to attach each file to the email. Attempt code adaptation and integration and post question when you encounter specific issue.

    I know about attaching files to Outlook email. I thought you wanted to create Outlook calendar or task item?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    well I can create a new topic for this. it started as a calendar task but then I wanted to figure out how to attach a file to the calendar item or task. I would assume it would be close to the same as the email thing, which I already had partial code for.

    To answer your questions.....

    I only need to know how the code fits together. The file identification is included in the suggested code which I should be able to figure out once I figure out how the code fits together. My code allows me to send an email with one button with the option to manually enter a path location for file attachments. Now I just want to be able to incorporate all the files from the attachments field, in with the send email code (or calendar code).

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    So one procedure can call the other or you can mesh it all together as one long procedure. Just build it to do things in the order you prefer. User clicks button 'Send Email'. The email code starts. When it gets to the attachment part, call the procedure to save record's attachment files to table and loop through the folder to attach file(s).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    getting back on the original topic..... I have successfully implemented the new function to add calendar items based on the click of a command button. Im now running into a situation where I need to create a calendar item 2 days out everytime I click the button instead of the day of. What is the syntax for something like that?

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Show the code for saving the calendar item.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM
  2. Creating and Formating Outlook Task
    By steve-bart in forum Programming
    Replies: 2
    Last Post: 08-26-2011, 02:18 PM
  3. Update Outlook task from Access
    By timg147 in forum Programming
    Replies: 1
    Last Post: 08-16-2010, 12:27 PM
  4. Add task from Access to Outlook
    By Johan in forum Programming
    Replies: 1
    Last Post: 03-31-2010, 09:58 AM
  5. Export Access reports/query results to Outlook Calendar/Task
    By kfinpgh in forum Import/Export Data
    Replies: 0
    Last Post: 02-22-2007, 01:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums