wordpress statistics
  • Today is Friday, February 10, 2012

3 Responses to “Animated Floating Calendar”

  1. Anonymous says:

    This is a great tool, and with some modification, I was able to make it work in a sub-form scenario.

    First, you will have to give up the ability for a person to manually enter a date. The calendar becomes the only form of entry. Second, (for best results) the calendar should be set to appear in a fixed point, on the screen.

    Assuming you can live with the above, then making the following code changes should help make things work on a sub-form.

    Step 1: Install the calendar contorl on the main form.

    Step 2: The three Private Sub code-sets, listed after step 5, should be added to the Main Form, and not the sub-form.

    Step 3: Change the third sub (Form_Load) to read:

    Private Sub Form_Load()
    [Forms]![mainform]![subform]![Cal1].Value = Date
    End Sub

    Even though you are selecting a control from a sub-form, that control is considered a member of the main form, and thus triggers the code from the main form.

    Step 4: In the code for function Calendar, add the following line before the line "Set CalCtrl = Screen.ActiveForm.Controls("Cal1")". This tells the calendar to always open to the date on the control you selected, rather than the last date entered into the calendar.:

    Screen.ActiveForm.Controls("Cal1") = ctl

    Step 5: Modify the m_left & m_top paramters to be actual numbers. These are in twips so perhaps 3000 & 800 respectively, would be good starting points. Adjust as needed.

    Step 6: Within the code of function Cal1Click() add a line between "DoEvents" and "m_cal.Visible = False" like:

    [forms]![formname]![controlname].setfocus

    Otherwise the calendar control can't be hidden again…

    Also, if you wish to change the size of your calendar, you can modify the twips multiplier (.17 and .105), within the following code. (Code is from Calendar function):

    w = CalCtrl.Width + (0.17 * twips) ‘ 0.17″

    h = CalCtrl.Height + (0.105 * twips) ‘ 0.105″

    Hope this helps.

    Sharkbyte

  2. Hi,

    Thanks a lot for the good review and suggestions for improvement. I am glad that you like it and using it too.

    Regards,

  3. Interesting article for all the .net framework students and learners
    nice to know new and interesting topics like this

Leave a Reply

You must be logged in to post a comment.