[AccessD] Using Calender Pop-up (Date-selector) from ADH

Drew Wutka DWUTKA at marlow.com
Tue Jul 15 17:00:16 CDT 2003


The MiniCalendar has a 'cycle' mode, which allows you to have a second form
open, that shows the records for the date that the mouse is over on the
Minicalendar.  So as you move the mouse around the calendar, the 'side' form
keeps up to date with the MiniCalendar.
 
I think you are asking to create a monthly calendar report, where there are
boxes for each day of the month, offset then your typical wall calendar.
Ironically, the origins of the MiniCalendar is based on a form that was just
like that.  It was a work scheduling form, where each day 'box' showed the
hours the employee was scheduled for.  I created the first version of the
MiniCalendar, by shrinking everything down.
 
What you would want is a report version of that.  Not too difficult to do.
The process is just about the same as that used to create the minicalendar
form.  Essentially you need 37 'boxes', with the appropriate data displaying
controls in each (everything labeled with a number at the end, like DayBox1,
DayBox2....DataLabel1, DataLabel2...etc.).  You need 35 for a 5 by 7 grid,
with a bottom row of 2.  (So if the 1st is a Saturday, and the 31st is a
Monday, it shows appropriately.).  Then you just have to run some simple
code to determine the first day of the month, and the number of days in the
month.  Then you set an 'offset' variable.  If the first day of the month is
a Sunday, the offset is 0, if it's Monday, the offset is 1, all the way to
if it's Saturday, the offset is 6.  Thus, whenever you refer to a control,
by date, you take the number of the day of the month (1st through 31st), by
using the Day() function, then you add the offset to get the 'box' or
control number to refer too.  
 
For example, this month has 31 days, and the 1st is on a Tuesday.  That
means that the offset would be 2.  When the report opens/loads, you would do
a for 1=1 to 37 next statement, where you would set me(MyControlName &
i).Visible to whether or not the day is valid.  To determine that, you
determine if i<=offset which would tell you which controls to show starting
from the front, and i-offset<=NumberOfDays , which hides the end controls
that don't represent the current month.
 
You now have a grid representing the days of the month.  To put the day of
the month in the boxes, on the initial loop that hides/shows the appropriate
controls, just set a little label's caption to i-offset, which will then
number the days correctly.  Then, to fill the data in, pull up your
recordset (for the month), and run through each record.  To 'know' what
control gets the data, you simply use the Day() function and the offset
variable.  
 
For example.  If I have a record with 7-5-2003 as the data, by using the
Day() function, I would know that the date is for the 5th (it will return
5).  By adding the offset (of 2), we know that we would want to add the data
to the controls ending in 7.
 
So, for example, we could use this line:
 
Me(MyDataLabel &
(Day(rs.Fields("MyDateField").Value)+intMyOffsetValue).Caption=rs.Fields("My
DataField").Value
 
Whalla, your entire calendar report is then filled with the appropriate data
with that line put into a For Next Loop of all your records.
 
The MiniCalendar Version 3 (the 97 version) has a lot of the functionality
that you want put into modules within the database.  I have a function to
return the number of days in a month, the first day of the month, etc.
(Those are pretty easy, and I am pretty sure the latest version uses pretty
good code (my very first version was, quite frankly, attrocious, since I was
just learning VBA....of course the MiniCalendar was a wonderful learning
tool, because it forced me to get a much deeper understanding of a lot of
things, when building it.).
 
Now, the beta version, which is 2000 only, has no modules, other then the
form itself (yet....).  I did that intentionally, because the last complete
version requires several 'objects' to be ported into a database, and one of
the features I wanted incorporated into the new version, was that I wanted
it to be JUST the form that needs to be imported.  Also, I had several
'internationalists' complain that the MiniCalendar starts with Sunday as the
first day of the month.  (The current version does reword the month list and
day names based on their locale.).  So the Beta version (which has been
collecting dust since the fire in my apartment!), has already had a flexible
start day built in, you can set the first day of the week to be Sunday
through Saturday.  
 
I have literally broke the secret calendar builder's code of silence, so I
probably will not be alive tomorrow! <evil grin>.  Just kidding.  Hopefully
if you read through this carefully, you'll understand what I am talking
about, and realize that what you are looking for is not very difficult at
all, you just have to understand the mathematics behind it.
 
Drew

-----Original Message-----
From: Susan Harkins [mailto:harkins at iglou.com]
Sent: Tuesday, July 15, 2003 3:36 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Using Calender Pop-up (Date-selector) from ADH


Drew, right now I use an Access app for scheduling, but also duplicate a
task list in Outlook because I love the calendar layout. Do you think your
MiniCalendar could reproduce that in my Access app? All I really want is to
print tasks on the appropriate day and print out a "calendar" page. It's a
nuisance to have to use both and I just haven't made the time to take a hand
at doing it myself in Access. 
 
Susan H. 

 

I have a form based calendar called the MiniCalendar.  The last complete
version was built in Access 97.  I used to have it on my website, but I have
yet to have any time to put it back on my new site.  If you want, I can
email you a copy off list.  ( dwutka at marlow.com <mailto:dwutka at marlow.com>
).  It's free to use, and distribute, though the 'word doc' instructions
were written for version 2 (latest version is 3), so it's a little off, but
the MiniCalendar is pretty easy to use.
 
I am still working on Version 4, which is going to be for 2000 and up only
(ran into a few walls in 97 for features that I want incorporated).
 
Anyhow, just give a holler if you want a copy of that or not.
 
Drew

-----Original Message-----
From: Backroads Data [mailto:backroad at idir.net]
Sent: Tuesday, July 15, 2003 9:23 AM
To: AccessD
Subject: [AccessD] Using Calender Pop-up (Date-selector) from ADH


Hi all -
 
In Access97, I've used the pop-up calender / date-selector from Access97
Developer's Handbook (pp. 488-491) extensively throughout an application.
I've had reports from various users that the calendar will quit working
intermittantly for a while, then start to work again.  
 
By "not working", they mean the calendar form appears, they can navigate to
any date, but when selecting a date the system fails to update the date
field (text box on the form) with the newly selected date.  It will be in
this state for a while, then will begin working properly again.
 
Below is the code I'm using to call the calendar and update the date field.
Has anyone had any similar experience, or have any ideas what might be
happening?  TIA.

Private Sub dateStart_DblClick(Cancel As Integer)
 
    Dim dateNew As Variant
    
        Let dateNew = adhDoCalendar(Me.dateStart)    'get user's selected
date
        
        If IsNull(dateNew) Then         'user cancelled calendar form
            Exit Sub
        Else
            Me.dateStart = CDate(dateNew)
        End If

End Sub

Best Regards,
 
Julie Schwalm
Backroads Data
www.backroadsdata.com <http://www.backroadsdata.com> 
785-594-6807



  _____  




_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030715/39e1be85/attachment-0001.html>


More information about the AccessD mailing list