Lebans Calendar (1 Viewer)

alphaomegastephan

Registered User.
Local time
Today, 05:24
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 :)
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 05:24
Joined
Jul 9, 2003
Messages
11,668
That's a very nice looking calendar form Colin, thanks for that!
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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!
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 05:24
Joined
Jul 9, 2003
Messages
11,668
I couldn't believe it when Microsoft stopped providing their activex calendar control...

I went over to Allen Browne's calendar here:- http://allenbrowne.com/ser-51.html --- but I shall be changing over to that one from Brendan Kidwell..

Did you see my class module where, in combination with Allen's calendar control --- you can mimic the after update event after you've updated the date? 11) - Class Module to Mimic AfterUpdate Event - Nifty Access

I'll see if I can set it up to work with Brendan Kidwell's Calendar...
 

HiTechCoach

Registered User.
Local time
Yesterday, 23:24
Joined
Mar 6, 2006
Messages
4,344
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
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
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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 ...
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
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:

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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:

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
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.
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
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
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
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

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
Thank you Ridders.

I'll give it a go on Monday as is and report back.
 

alphaomegastephan

Registered User.
Local time
Today, 05:24
Joined
Mar 3, 2015
Messages
13
Sorry about the delay, Just got back to the office,

That works perfectly thank you Ridders :)
 

isladogs

CID Moderator
Staff member
Local time
Today, 05:24
Joined
Jan 14, 2017
Messages
13,433
You're welcome.

Did you use the date picker I supplied or modify the lebans calendar for 64 bit?
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:24
Joined
Sep 21, 2011
Messages
6,020
The original worked fine as well Ridders.

Thank you
 

LukeAB

New member
Local time
Today, 14:24
Joined
Mar 5, 2020
Messages
1
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 ...
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom