Calendar (Stephan Lebans)in form

  • Thread starter Thread starter ron
  • Start date Start date
R

ron

Hi

My form has 12 textboxes to fill in different dates like

date of arrival
date start loading
date completion
date docs onboard
date sailing
a.s.o.

I like to implement Mr StephanLebans Calendar in my Database

http://www.lebans.com/monthcalendar.htm#Navigating within the Month Calendar

It seems I have to copy for each textbox the VB code in the
doubleclick procedure and rename the name of the box in the copied VB
code. (12 different VBcodes?)

I am sure there must be an easier way to handle this.

Who can help me to solve this problem ?

Thanks in advance for your help

Best regards,
Ron
 
You could have a generic function and set the DoubleClick event of the 12
boxes to call that function.

I think the following untested air code should work:

Private Function GetDate()
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date

dtStart = Nz(Me.ActiveControl.Value, 0)
dtEnd = 0

blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.ActiveControl = dtStart
Else
' Add any message here if you want to
' inform the user that no date was selected
End If

End Function

Now, put =GetDate() (including the equal sign and parentheses) for each of
the 12 DoubleClick events.
 
Hi Douglas
Thanks for your help
It is not that easy. Iam a nerd in VB but understand some items.
I copied below in the VB code and put in the double click event
=GetDate()
The program stops at blRet = ShowMonthCalendar(mc

Is it possible to put a printscreen in this message? then I can explain
what I want to do
and what goes wrong

Best rgrds
Ron Stolk (Netherlands)
 
Douglas
Sorry

I just found out a small part of the code was missing
Now it works just as I want
Thanks a lot

Best regards
Ron Stolk
 
Douglas
Sorry

I just found out a small part of the code was missing
Now it works just as I want
Thanks a lot

Best regards
Ron Stolk
 
Back
Top