Lebans Calendar

alphaomegastephan

Registered User.
Local time
Today, 22:13
Joined
Mar 3, 2015
Messages
13
Hi All,
Just a quick question,
I want to use the Lebans Calendar on my database (http://lebans.com/monthcalendar.htm) however it appears it is not compatible with 64 bit Systems,
does anyone know how to change this / get around this?

All i want to do is display a calendar on the database to the side, where you can scroll through the months to see days and dates for each month but it doesn't need to do anything else, Its purely visual.

Cheers
Stephan :)
 
Hi

I don't use Stephen's calendar but I do have an alternative which DOES work in 64-bit Access - see DatePicker.accdb attached

Its not my code but is open source:

Copyright (c) 2003 Brendan Kidwell

' The latest version of this software can be found at
' http://www.glump.net/content/accessdatepicker/ .

If all you want is a visual calendar, it will certainly do that
However, in addition, you can use it to input a date on a form textbox

All you need for that is :

Code:
Private Sub txtDate_Click()
    InputDateField txtDate, "Select a date to use this on your form"
End Sub

To use, copy frmDatePicker & modDatePicker to your own database


However, if you do want to convert Stephen Lebans' calendar then you need to modify all declarations with code similar to that below where the code in blue is the original & that in red is added for Win64 / 64-bit Office:

Code:
'#####################################
[COLOR="Red"]'Add PtrSafe - required for 64-bit Office (VBA7)
#If VBA7 Then
        Private Declare PtrSafe Function SHFileOperation Lib "shell32.dll" _
          Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

#ElseIf Win64 Then 'need datatype LongPtr
        Private Declare PtrSafe Function SHFileOperation Lib "shell32.dll" _
          Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As LongPtr
    
#Else '32-bit Office[/COLOR]
   [COLOR="Blue"] 
        Private Declare Function SHFileOperation Lib "shell32.dll" _
          Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long[/COLOR]
[COLOR="red"]
#End If[/COLOR]
'#####################################
 

Attachments

Last edited:
It works well & is much simpler than the Lebans code.

I had the same problem as the OP so started to write my own ...
When I found that one, it did all I needed so scrapped mine!
 
Here is another great Access calendar with some other cool code.

Proximity Functions

"Proximity Functions" is a set of Microsoft® Access® modules, forms and controls that you can use to easily add professional functionality to your Access application without programming. By simply importing a few modules, then copying and pasting one control next to a text control on your form you can add Windows-standard file open/save dialogs, folder browse dialogs, color selection dialogs, a fantastic calendar date picker dialog, and more.
 
Ridders,

Thank you for your datepicker db.
I only have Access 2007 and it fell over on setting backcolor for the button, which 2007 does not have as far as I can see?

Code:
        If I = SelectedDay And txtYear = SelectedYear And cboMonth = SelectedMonth Then
            Set cmdCurrentDay = btn
            'btn.BackColor = ColLemon
            btn.ForeColor = ColDarkRed
            btn.FontWeight = 600
            btn.FontSize = 10
        Else
            'btn.BackColor = ColPaleGrey
            btn.ForeColor = ColDarkBlue
            btn.FontWeight = 400
            btn.FontSize = 8
        End If
Just in case anyone else is on an old version of Access
 
Hi

OK - remember its not 'mine'

The code you quoted is from the DrawDateButtons procedure
In fact the date 'buttons' are labels

The fore/back colour code wasn't in the original mdb file released in 2003 (see link in post #2) so I must have added it.

It isn't crucial to the date picker functionality though I think it looks better for having the colour coding.

I no longer use anything before A2010 but I'm sure you could set the back colour of label controls back in Access 97!

In fact I've just checked an ancient mdb file and it specifies back colour in code ...
 
Hi

OK - remember its not 'mine'

The code you quoted is from the DrawDateButtons procedure
In fact the date 'buttons' are labels

Getting confused now.:confused:
The code shows
Code:
Private Sub DrawDateButtons()

On Error GoTo Err_Handler

Dim MonthDayOne As Date, MonthLength As Integer, DayOfWeek As Integer
Dim I As Integer, Y As Integer, x As Integer, [COLOR=Red]btn As CommandButton[/COLOR]

Edit:
Just noticed a line of code further up that was commented out, but not by me

' btn.BackColor = vbWhite
 
Last edited:
Hi Gasman,

That's interesting ....!

Dim I As Integer, Y As Integer, x As Integer, btn As CommandButton

The way the code is written, 'btn' has to be defined as something
I've just tried this:

Code:
Dim I As Integer, Y As Integer, x As Integer, btn As [COLOR="Red"]Label [/COLOR][COLOR="SeaGreen"]'CommandButton[/COLOR]
and the form still works perfectly for me (in Access 2010)

Try that in A2007 and see if it works OK for you

NOTE:
The form has 42 date 'button labels' (I've just invented a new control type!!)
The idea is that these only appear when the date exists in that month
I edited out the line
' btn.BackColor = vbWhite
when I changed the form back colour from white to pale blue.
 
Last edited:
Hi Ridders,

I'm happy to leave it the way it is (at present at least)
I just wanted to make sure I had not missed anything with the code.
 
Hi Gasman

I'm happy to leave it the way it is (at present at least)
I just wanted to make sure I had not missed anything with the code.

OK but I just wondered if that would fix the back colour issue you mentioned in A2007
 
Good Morning Ridders,
I amended the code as you have shown,

Code:
Dim MonthDayOne As Date, MonthLength As Integer, DayOfWeek As Integer
Dim I As Integer, Y As Integer, x As Integer, btn As Label
but it then gives error message type mismatch, due to I believe
Code:
I = 2 - DayOfWeek
For Y = 0 To 5
    For x = 0 To 6
        [COLOR=Red]Set btn = Me.Controls("d" & Y & x)[/COLOR]
        ' If i falls within legal days for this month, show
and controltype is 104 for the dyx controls, which is a commandbutton according to a google.

Not to worry, I was more interested in the functionality and it works fine after commenting out the backcolor property.

Hi Gasman



OK but I just wondered if that would fix the back colour issue you mentioned in A2007
 
In case you want to try it, attached is the original date picker as written by Brendan Kidwell in 2003

As you will see, I modified it a fair bit...
 

Attachments

Thank you Ridders.

I'll give it a go on Monday as is and report back.
 
Sorry about the delay, Just got back to the office,

That works perfectly thank you Ridders :)
 
You're welcome.

Did you use the date picker I supplied or modify the lebans calendar for 64 bit?
 
The original worked fine as well Ridders.

Thank you
 
opening this up - has anyone converted the Lebans one to 64 bit. The reason I like it is the that a person can select a date span, and as far as I can tell no other calendar does that.

I tried converting Lebans by using PtrSafe and LongLong etc but made a right mess of it... won't compile and some of the declare are not behaving with LongLong ...
 
I tried a bit to do the conversion. Rather than LongLong you should use LongPtr in most places, however, I still did not get it to work. When creating a the object of clsMonthCal and using the ShowRangeCal to initate, I get as far as the WindowProc call (initiated by the apiCreateWindowEx call in the modCalendar.ShowMonthCalendar function) and Access simply crashes silently (App Event Log shows either a EventID 1000 or 1002).


I used the Win32API SafePtr reference (Win32API_PtrSafe.txt -see txt file for URL as wouldn't let me post with it inline) to determine what param and returns need to LongPtr and then extrapolated what local/global var's may need to be based on their receiving result of functions or placed as parameters. Attached are the rough outline of changes I made. If anyone would care to double-check and then help further trouble-shoot, that would be awesome.
 

Attachments

opening this up - has anyone converted the Lebans one to 64 bit. The reason I like it is the that a person can select a date span, and as far as I can tell no other calendar does that.

I tried converting Lebans by using PtrSafe and LongLong etc but made a right mess of it... won't compile and some of the declare are not behaving with LongLong ...
I see your question is almost a year old. I thought I would reply to it anyhow just in case you were still looking.

All too often I need a calendar that shows more than just one month. That is why I much prefer Leban’s calendar to any other calendar I have used. I like the fact that you can select the number of months to display and as you mentioned, one can select consecutive days. Your correct in stating no other calendar has these features.

I decided I needed to modify my applications to run in 64-bit because Microsoft is installing 64-bit office by default in new computers. I do not want to ask my clients to uninstall 64-bit and download and install 32-bit. I feel it is best from a business relations point of view to have my applications run on whatever my clients have on their machines.

I have just finished modifying the codes for Leban’s month calendar to work in both 32-bit and 64-bit access. At least it seems to function good on both my 32- and 64-bit machines.

If you are still interested in obtaining the codes let me know.
 

Users who are viewing this thread

Back
Top Bottom