Results 1 to 5 of 5
  1. #1
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77

    Connecting Azure SQL to Gmail/Outlook Calendar


    i have an Azure SQL database with an Access 365 front end. i have a table called Contracts that has dates and times in it. i would like to display this in a calendar either Gmail or Outlook. any assistance will be appreciated. it should automatically show new event in calendar when new record added to Contracts.

    Thanks

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    This code that I wrote uses names from Excel sheet column A and dates from column B to create recurring Outlook calendar events. If no one provides more focused code it should get you started by at least revealing some of the calendar event properties. I realize it's for Excel - you would have to adapt. The AfterUpdate event (don't know which you need; for form or for control) would be the event to use to add a calendar event when you add a record. If you use code to create the initial events for your current records, you would not want to re-run the exact code each time you add a record. That would likely create duplicate events or at least errors.

    Code:
    Sub ImportBirthdaysToCalendar()
        Dim objWorksheet As Excel.Worksheet
        Dim nRow As Integer, nLastRow As Integer
        Dim objOutlookApp As Outlook.Application
        Dim objCalendar As Outlook.Folder
        Dim objBirthdayEvent As Outlook.AppointmentItem
        Dim objRecurrencePattern As Outlook.RecurrencePattern
     
        'Get the specific sheet
        Set objWorksheet = ThisWorkbook.Sheets(1)
        nLastRow = objWorksheet.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row
     
        Set objOutlookApp = CreateObject("Outlook.Application")
        Set objCalendar = objOutlookApp.Session.GetDefaultFolder(olFolderCalendar)
     
        For nRow = 2 To nLastRow
            Set objBirthdayEvent = objCalendar.Items.Add("IPM.Appointment")
     
            'Create birthday events
            With objBirthdayEvent
                .Subject = objWorksheet.Range("A" & nRow) & Chr(39) & "s Birthday"
                .Body = "Born " & Format(Int(objWorksheet.Range("B" & nRow)), "mmmm dd, yyyy")
                .AllDayEvent = False
                .Start = objWorksheet.Range("B" & nRow)
                .BusyStatus = olFree
                .ReminderSet = True
                .ReminderMinutesBeforeStart = 4320
             Set objRecurrencePattern = .GetRecurrencePattern
             With objRecurrencePattern
                .RecurrenceType = olRecursYearly
                .PatternStartDate = objWorksheet.Range("B" & nRow)
                .NoEndDate = True
             End With
                .Save
            End With
        Next
    End Sub
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    Thanks for the post. i am lokoing for some type of synching tool or something to live synch dates in SQL table with outlook or gmail calendar

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    You can't use access to sync or trigger an event based on a table event in SQL, it might not be running.

    You would probably have to look at a Microsoft flow or similar. You can trigger events based on data change or insert I believe.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,035
    You can run xp_cmdshell from a SQL trigger, but I wouldn't recommend it; You need to adjust the security settings to allow it, and running windows commands is a slow operation which could block your server.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-18-2022, 06:42 AM
  2. Replies: 10
    Last Post: 01-03-2020, 08:53 PM
  3. Using GMail instead of Outlook
    By Paul H in forum Reports
    Replies: 3
    Last Post: 01-03-2020, 09:50 AM
  4. Outlook.com V GMail. Your opinions please
    By Rainlover in forum Misc
    Replies: 10
    Last Post: 03-12-2019, 09:07 AM
  5. Replies: 3
    Last Post: 06-19-2016, 07:46 AM

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