Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2004
    Posts
    287

    Unanswered: Linking Outlook Template to Access

    I have created a database that checks a certain inbox and drags the appropriate 'normal' fields of the email across into the database (eg: Sender, Subject, Body, etc)

    But I want to use an Outlook Template (which I have created with new fields as well - eg: Course Name, Course Date)

    But how do I also import/drag these fields across as when I link it to the inbox it only shows/imports the normal outlook fields.

    Thanks.

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Could you post your current code.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Mar 2004
    Posts
    287
    for what part? I need to make sure the access grabs the outlook template non-standard fields? pleased explain what you would like me to post as my access coee only grabs the email from the inbox. (by means of linking to the exchange mailbox and importing into the main database)

  4. #4
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Ok I suppose I could take a wild guess then:-

    Item.UserProperties("YourCustomField")

    If that doesn't work, perhaps try Mystic Meg.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  5. #5
    Join Date
    Mar 2004
    Posts
    287

    Code

    Code:
    Private ola As Outlook.Application
    Private nsp As Outlook.NameSpace
    
    Public Sub InitOutlook()
        Set ola = New Outlook.Application
        Set nsp = ola.GetNamespace("MAPI")
        nsp.Logon , , False, False
    End Sub
    
    Public Sub CleanUp()
        Set nsp = Nothing
        Set ola = Nothing
    End Sub
    
    Public Sub SendEmailForm(varTo As Variant)
    
        Dim mli As Outlook.MailItem
        
        InitOutlook
        Set mli = ola.CreateItem(olMailItem)
        mli.To = [Forms]![Main]![Name]
        mli.Subject = "Course Evaulation Form"
        mli.Body = "Dear " & [Forms]![Main]![Name] '& "," & vbCrLf & [Forms]![LetterInput]![Letter1] & vbCrLf & [Forms]![LetterInput]![Letter2] & vbCrLf & [Forms]![LetterInput]![Letter3] & vbCrLf & [Forms]![LetterInput]![Letter4]
        'mli.SentOnBehalfOfName = "TrainingContracts@palmerslaw.co.uk"
        mli.Display
        'mli.Send
        
        Set mli = Nothing
        CleanUp
            
    End Sub
    Hope this helps.

  6. #6
    Join Date
    Mar 2004
    Posts
    287
    any further suggestions would be appreciated please?

  7. #7
    Join Date
    Mar 2004
    Posts
    287
    can anyone help please? I need to get this working ASAP.

    Thanks.

  8. #8
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Question Fields

    You are creating an olMailItem which is just a standard mail item - none of your custom fields exist in it.

    Head over to:-

    OutlookCode.com :: Add custom field\property to standard mail item

    Which will show you how to add the custom fields at runtime.

    You probably don't need anything more complex than that if I interpret your requirements correctly.

    I would recommend Sue Moshers book on Outlook 2007 Programming which is linked from outlookcode.com (Sue's old site).

    Hope this helps.

    If the 'template' includes layout changes etc then this will not work though so let me know.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  9. #9
    Join Date
    Mar 2004
    Posts
    287
    thanks i have had a look but do not understand entirely.
    i have the table linked to an exchange mailbox. I assume this I would need to completely change to VBA importing rather than exchange table import?

  10. #10
    Join Date
    Mar 2004
    Posts
    287
    any more suggestions?

  11. #11
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Hi Neil,

    Your linked table / inbox will not work - you will need to automate Outlook in a similar way to your example but using the createitemfromtemplate (once you've published it).

    CreateItemFromTemplate Method

    Dim mli As Outlook.MailItem
    Set mli = ola.CreateItemFromTemplate("C:\Youroftfile.oft")

    Sorry I cant be more detailed than this - if you haven't cracked it by the weekend I'll have a look for you.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •