• Using a calendar in a list box

    Author
    Topic
    #351769

    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

    Viewing 0 reply threads
    Author
    Replies
    • #510052

      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.

      • #510053

        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.

        • #510057

          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.

          • #510709

            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.

            • #510711

              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?

            • #510712

              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.

            • #510713

              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?

            • #510719

              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.

            • #510720

              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!

            • #510729

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

            • #510746

              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?

            • #510762

              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().
              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.
              You can download this database (93KB zipped): http://www.msnusers.com/MarkJ/files/Popups.zip%5B/url%5D


              -MarkJ-

            • #510878

              Thanks everyone. I have been trying to figure this out for years and I think I have it.

    Viewing 0 reply threads
    Reply To: Reply #510762 in Using a calendar in a list box

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel