Results 1 to 13 of 13
  1. #1
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388

    Monthly Calendar - Easy to use your data



    Code:
    CalendarMonthView-davegri-v01.zip
    Inspired by: https://bytes.com/topic/access/insig...endar-overview


    Attached is an example of a monthly calendar database. The VBA contains many comments on the implementation scheme and code notes. It shouldn't be very difficult to modify things to display your data. I've included a table and form for calendar settings that allow customization of the calendar colors as well.

    Click image for larger version. 

Name:	TheCal.png 
Views:	574 
Size:	29.1 KB 
ID:	46025

    The Color customize form:

    Click image for larger version. 

Name:	colors.png 
Views:	571 
Size:	27.7 KB 
ID:	46026

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    That's a really nice and simple (considering the possible complexities) interface for a calendar.
    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 ↓↓

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    I had to laugh when I saw you posted this. Ever since we both responded in this thread https://www.accessforums.net/showthread.php?t=84154 , I've been tweaking the code on my calendars.
    Consolidated a few procedures, eliminated others. The goal is trying to make it as simple as possible for others to customize but as minty points out there are so many complexities it's certainly a challenge.
    In any event it's a fun exercise to pass the time. I'll apologize now for any of your ideas I steal.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  5. #5
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Quote Originally Posted by moke123 View Post
    I had to laugh when I saw you posted this. Ever since we both responded in this thread https://www.accessforums.net/showthread.php?t=84154 , I've been tweaking the code on my calendars.
    Consolidated a few procedures, eliminated others. The goal is trying to make it as simple as possible for others to customize but as minty points out there are so many complexities it's certainly a challenge.
    In any event it's a fun exercise to pass the time. I'll apologize now for any of your ideas I steal.
    Yes, it's hard to be original with such a common and needed application. As noted, mine is certainly not original at its roots.

    I have another version of this calendar that automatically resizes itself depending on the Access window screen size (or optionally a user specified size). The resizing code redraws and repositions all the text boxes and other objects. I didn't post that one because I consider it too unstable. If anything goes wrong during the screen re-creation, it is by definition (and reality) a corrupt database, and requires some tiresome procedures to recover. That's too much of a burden for anyone to tolerate.

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388

    Calendar upgrade, holidays and date ranges

    CalendarDateRange-Holidays-davegri-v02.zip

    Enhancements:
    This calendar will handle events that span more than one day if the appointment Startdate and EndDate differ.

    • Added Help button on frmCalendarSettings to display help for some options.
    • Added table/code to accommodate and show USA holidays, 2017 thru 2030.
    • Added option to skip showing weekend and holiday appointments.
    • Added option to include/exclude AM and PM suffix to times.
    • Added option to set font size of calendar display.
    • Added custom color selection for Holidays.
    • All the options are implemented via TempVars switches or values.


    New Options:

    Click image for larger version. 

Name:	calopt.png 
Views:	543 
Size:	62.3 KB 
ID:	46086

    Shows Holidays:

    Click image for larger version. 

Name:	shoCal.png 
Views:	543 
Size:	24.0 KB 
ID:	46087

  7. #7
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Dave,
    I told ya I was gonna steal some of your ideas.

    I was thinking about adding the holidays but didnt want to bother with a having to maintain another table.
    In my calendars I use a dictionary object for the event dates. I've found this makes for an easy way to add the event text to the date boxes rather that using an array.

    I extended that idea to using a dictionary object for the holidays rather than tables. I can even take into consideration whether a holiday that falls on a weekend being observed on a friday or monday.

    Here's a stripped down example without any events, just the holidays. Just scroll up and down through the months. There's only a handful of holidays listed but I'll be adding more in time.
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Quote Originally Posted by moke123 View Post
    Dave,
    I told ya I was gonna steal some of your ideas.

    I was thinking about adding the holidays but didnt want to bother with a having to maintain another table.
    In my calendars I use a dictionary object for the event dates. I've found this makes for an easy way to add the event text to the date boxes rather that using an array.

    I extended that idea to using a dictionary object for the holidays rather than tables. I can even take into consideration whether a holiday that falls on a weekend being observed on a friday or monday.

    Here's a stripped down example without any events, just the holidays. Just scroll up and down through the months. There's only a handful of holidays listed but I'll be adding more in time.
    That's pretty neat. It's all tradeoffs. If a new holiday is declared or changed, or a holiday differs from state to state, the table is the easiest way for the user to manage, without resorting to code changes.

  9. #9
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Many are "the 3rd monday in February" or "last Monday Of Sept." type holidays and I doubt July 4th, Christmas or New Years are ever gonna change.
    I like that they're dynamic. They're fairly easy to code, so changes, if they ever happen, should be relatively easy to make but I get what you're saying.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    In case its useful, see my article Easter Calculator - Mendip Data Systems which is used as part of the code in my own monthly/weekly/daily calendar app
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Quote Originally Posted by isladogs View Post
    In case its useful, see my article Easter Calculator - Mendip Data Systems which is used as part of the code in my own monthly/weekly/daily calendar app
    Thanks Colin. Easter looks a little complicated so i'll just steal yours

    edit: works great!
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Its a very neat solution - based on Chip Pearson's Excel code with minor modifications for Access
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #13
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Quote Originally Posted by isladogs View Post
    Its a very neat solution - based on Chip Pearson's Excel code with minor modifications for Access
    Very nice. Wrote one off sub to loop on 2017 to 2030 to add Easter dates to tblHolidaysUSA in post#6, this thread.

    Anybody else who wants the update:

    Code:
    Public Function fcnGetEasterSunday(Yr As Integer) As Date
        'Code taken from http://www.cpearson.com/excel/Easter.aspx
        Dim D As Integer
        D = (((255 - 11 * (Yr Mod 19)) - 21) Mod 30) + 21
        fcnGetEasterSunday = DateSerial(Yr, 3, 1) + D + (D > 48) + 6 - ((Yr + Yr \ 4 + D + (D > 48) + 1) Mod 7)
    End Function
    
    
    Public Sub InsertEaster_tblHolidays()
        Dim x As Integer
        Dim sSQL As String
        For x = 2017 To 2030
            sSQL = "Insert into tblHolidaysUSA (DayofWeek, HolDate, HolidayName) Values(" _
            & "'Sunday', #" & fcnGetEasterSunday(x) & "#, " & "'Easter'" & ")"
            Debug.Print sSQL
            CurrentDb.Execute sSQL, dbFailOnError
        Next
    End Sub
    Put in a module and call from the immediate window. Run it only once!

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

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2018, 12:51 PM
  2. Format a report to look like a monthly calendar
    By msmithtlh in forum Reports
    Replies: 5
    Last Post: 03-07-2017, 03:59 PM
  3. Replies: 3
    Last Post: 10-30-2014, 06:24 AM
  4. Replies: 6
    Last Post: 11-10-2012, 09:49 PM
  5. Replies: 0
    Last Post: 03-29-2011, 09:37 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