Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2004, 03:56 PM
Registered User
 
Join Date: Jun 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Active X calendar

Hi,
I inserted an Active X control "Calendar Control 9.0" into my form. I have 3 date fields in my form and would like to have all 3 fields work with the calendar. The fields are "Date Sent", Date Due Back", and "Date Returned" When I go to the calendar properties and it's control source, I can only select one date to work with the calendar. Is there any way I can get it to work with the 3 fields in my form. Thanks for helping.

 
Old October 22nd, 2004, 11:25 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

I have a similar thing working on one of my forms. I have the activeX control hidden, and I declare 2 variables - getDate and calling. I use getDate if there is already a date in the field and I use calling to identify which control is calling the calendar. I then place a cmdButton next to each box. On the Click of the button, both variables are set and the getCalendarDate sub is called which makes the Calendar control visible and sets the date (if appropriate). When the calendar is clicked, the calling variable is referenced and the appropriate text box is changed, and the calendar control hidden. Let me know if you want more information.

Private Sub cmdStart_Click()
    txtStartTime.SetFocus
    getDate = txtStartTime.Text
    calling = "txtStartTime"
    getCalendarDate
End Sub

Private Function getCalendarDate()
    If getDate = vbNullString Then
        getDate = Now()
    End If
    ocxCalendar.Visible = True
    ocxCalendar.SetFocus
    If Not IsNull(getDate) Then
        ocxCalendar.Value = getDate
    Else
        ocxCalendar.Value = Now()
    End If
End Function

Private Sub ocxCalendar_Click()
    Select Case calling
        Case "txtEntryDate":
            txtEntryDate.SetFocus
            txtEntryDate.Text = ocxCalendar.Value
        Case "txtStartTime":
            txtStartTime.SetFocus
            txtStartTime = ocxCalendar.Value
        Case "txtEndTime":
            txtEndTime.SetFocus
            txtEndTime = ocxCalendar.Value
    End Select
    ocxCalendar.Visible = False
End Sub


Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar like calendar in AJAX in ASP.NET h@ckerz ASP.NET 2.0 Professional 0 February 19th, 2008 12:56 AM
help with my calendar Callylj Java Basics 0 February 24th, 2006 02:44 PM
Calendar Help allee_man VB How-To 3 April 19th, 2005 05:44 AM
calendar trangd Beginning PHP 2 June 1st, 2004 04:36 PM
Calendar kekohchaa VS.NET 2002/2003 4 April 7th, 2004 05:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.