UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Another Calendar!    
 
   
pere_de_chipstic...
post Jan 13 2012, 03:22 PM
Post #1

UtterAccess VIP
Posts: 7,646
From: South coast, England



Attached is a calendar demonstration which is self contained within a single form - No other tables, modules or macros!

The calendar has been constructed such that it interfaces through three code sub routines to the rest of the database
1. Sub: 'ImportFormating'
This allows the calendar to interrogate another table in the db and set the properties of the date controls on the calendar.
It is called wheneved the month or year on the calendar is changed
2. Sub: 'ExternalUpdate'
Allows 'external' controls to be changed whenever a date is selected or changed on the calendar.
3. SetDateProps (Version 2)
External code can call this routine, the routine will set the calendar to the month containing the date passed to it, colour the border with the colour passed to it and the background colour to cyan, if the bolReset argument is set the code will clear the given date control, ie background white and the border black. This can be called with (e.g.) Forms.SomeFormName.subfrmCalendar.Form.SetDateProps #2/12/2012#, 0, vbRed

These are provided as the last three subroutines in the form 'subFrmCalendar'


The attachment holds 2 database files in both A2000 and A2007 formats.
1. the basic calendar with no interfaces 'CalendarDemo Basic'
2. the calendar added as a subform interfacing with a second subform allowing a note to be added to each date. 'CalendarDemo'

Note that in the parent/subform version, the calendar sub form on load event (a call to 'btnToday_Click') is removed and replaced by a call in the parent form's on load event ('Me.subfrmCalendar.Form.btnToday_Click')

The db has been populated with the UK bank holidays for 2012 (Not many!)

Any feedback or suggestions on the calendar would be much appreciated.

EDIT:
Version 2 caters for different system Start of Week values
Version 2.1 corrects errors found in V2
Attached File(s)
Attached File  CalendarDemo_2000_basic_v2.1.zip ( 197.72K ) Number of downloads: 278
 
Go to the top of the page
 
+
pere_de_chipstic...
post Jan 16 2012, 09:04 AM
Post #2

UtterAccess VIP
Posts: 7,646
From: South coast, England



Having modified the calendars to take into account different system Day of Week start days, I've introduced an error in Version 2 (IMG:style_emoticons/default/blush.gif)

On
Form: subfrmCalendar
Sub: ImportFormatting()

The following lines should be deleted
CODE
'    'Clear calendar borders
    For i = 1 To 42
        Me("Date" & i).BorderStyle = 0
        Me("Date" & i).BorderColor = vbBlack
        Me("Date" & i).BackColor = vbWhite
    Next i


These occur immediately after the variable Dim statements, as they prevent the date being selected (shown in Cyan) when moving between months.

Thanks - and apologies!

Edit: V2.1 corrects error in V2, V2 removed

This post has been edited by pere_de_chipstick: Jan 16 2012, 11:07 AM
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th June 2013 - 12:13 AM