Results 1 to 4 of 4
  1. #1
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45

    Troble creating automatic email reminders for due tasks

    Hi ,
    I have created a module where it sends automatic email reminders to designated people via Outlook. While running the code, I got first the compile error as User type not defined. So for that I went to Tools>References> and Ticked on the MS Outlook Object Library 14. But still again I after running the code again, it gives the Complie error now

    Block If without End If

    Please help me to fix it.

    I am including few lines of the module

    Function GenerateEmail(MySQL As String)
    ' On Error GoTo Exit_Function:
    Dim oOutlook As Outlook.Application
    Dim oEmailItem As MailItem

    Dim rs As Recordset
    Set rs= CurrentDb.OpenRecordset(MySQL)
    If rs.RecordCount> 0 Then


    rs.MoveFirst
    Do Until rs.EOF
    If IsNull(rs!Email) Then
    rs.MoveNext
    Else
    'Set oOutlook = GetObject(,"Outlook.application")

    If oOutlook Is Nothing Then
    Set oOutlook = New Outlook.Application
    End If
    Set oEmailItem = oOutlook.CreateItem(olMailItem)
    With oEmailItem
    .To = rs!Email
    .Subject = "Task due in...

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would help to see all the code. It may not be an If/Then block, it could also be an overlap of an If/Then block with the loop.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45
    Well I solved the issue I was having. I was missing an "End If" satement

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 01-08-2015, 12:34 PM
  2. Send automatic email alerts from access
    By RERM in forum Programming
    Replies: 5
    Last Post: 09-03-2013, 03:49 PM
  3. Replies: 1
    Last Post: 02-07-2012, 09:50 AM
  4. Automatic Email
    By Peacekeeper in forum Access
    Replies: 8
    Last Post: 11-03-2011, 10:55 AM
  5. Maintenance reminders using email (complex question)
    By avarusbrightfyre in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2011, 05:18 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