Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using a calendar in a list box

    I would like to be able to go to a date field in a form and when I click on the arrow on a list box the calendar will appear (much the same way as it happens in Outlook). Then when I select the date, the date will go in the field and the calendar will disappear. Any idea of how to do this

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    Hi,
    You can use the MS Date and Time Picker control to do this - you should find it under Additional Controls (it may depend on what Office stuff you have installed). Just set its data source to whichever field you want.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    I think MS Date and Time Picker an ActiveX object is available on one computer because I installed Visual Basic on that particular computer. It did not seem to be available on my other computers. It is pretty neat and easy to use without a lot of coding. However, I found that when I used that tool and selected the data source as a field from my query, I could not leave that field blank, as a default it inserted today's date. When my form opened to allow a user to add a new record and then they decided to lookup a current record instead of adding a new record, a new record was added anyway with the current date in the field utilizing that tool.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    Oops. I've got Developer Edition on mine so I guess that's why I've got the control. I believe that if you set the CheckBox property to True then you can leave the field null by unchecking it (but I wouldn't swear to it off the top of my head)
    You could use the Calendar Control but it's not as nice in my opinion.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    Sorry, but I'm not the most advanced user. I need a step-by-step explanation. If I wanted to go to the Rock and Roll Hall of Fame, I am hearing the answer, "It's in Cleveland." What I need are the directions of how to get there.

    Thanks.

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    Sorry John,
    I have a bad habit of assuming how much people already know (I work on the basis it's better than talking down to them)!
    In Design View of the form, on the Toolbox toolbar there should be a button with a hammer and spanner (or wrench) on it with three dots underneath. Clicking on this will bring up the list of additional controls available. Check to see if the MS Date and Time picker is there, if not you'll have to use the Calendar control. This can be bound to your date field in the same way as any other control.
    Hope that helps?
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    Found it! I was always trying to figure out how to do it with the calendar control. So when I use the Date and Time Control Picker, how do I make the date picked end up in the field I desire, change the control source on the properties? I tried this and it didn't work.

  8. #8
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    Is it the only control on your form bound to the date field? It should be - if you have another (e.g. you mentioned a list box?) you need to delete it. Then it should work OK.
    Also, don't forget to change the CheckBox property to Yes.
    Does that help?
    Regards,
    Rory

    Microsoft MVP - Excel

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    Got it! Final question: How do I then get the date to be place in the control source field as soon as I click on it. It has something to do with the get focus, right? If not, tell me. Bye the way, Rory, I really appreciate your reply to my question.

  10. #10
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    If the D&T Picker is bound to the field then as soon as you pick a value, it should populate the underlying field automatically just as a text box or list box would. Is it not working?
    Always glad to help when I can![img]/w3timages/icons/smile.gif[/img]
    Regards,
    Rory

    Microsoft MVP - Excel

  11. #11
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    It only seems to work when I exit the date picker, not when I select the date.

  12. #12
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using a calendar in a list box

    On my forms, as soon as I choose a date, the pop-up bit disappears and the control is populated with the date chosen. Is that not what is happening on yours or is that not what you're after?
    Regards,
    Rory

    Microsoft MVP - Excel

  13. #13
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    I have a database containing several popup windows: "Zoom" text box with formatted text, Calculator, and Calendar. I've used the calendar form for quite a few applications and it works VERY well. I don't know who to give credit to because I can't remember where I found this([img]/w3timages/icons/sad.gif[/img]).
    To use the calendar, just copy the Calendar form ("zsfrmCalendar") and the Calendar module ("basCalendar") into your database. Then place the function "=PopupCalendar([Fieldname])" into the control source of the desired field.

    This was written in an earlier version of VB and doesn't require any OCX controls to work.

    I would attach this to the this post, but the attach feature seems to be disabled for my account.[img]/w3timages/icons/sad.gif[/img]
    You can download this database (93KB zipped): http://www.msnusers.com/MarkJ/files/Popups.zip

    [img]/w3timages/icons/thinks.gif[/img]
    -MarkJ-

  14. #14
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calendar in a list box

    [img]/w3timages/icons/laugh.gif[/img] Thanks everyone. I have been trying to figure this out for years and I think I have it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •