Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calender Control 4

Status
Not open for further replies.

BF

Programmer
Feb 13, 2000
10
CA
I have a question about the &quot;Calender Control.&quot; Other programming languages give you the ability to click on a text box that is looking for a date and a calender pops up. You then can click on a date in the calender and the date you clicked on will fill the text box automatically. Is this possible with the Calender control in Access? <p>BF<br><a href=mailto:g43@tc3net.com>g43@tc3net.com</a><br><a href= > </a><br>
 
Yes but you have to do some VBA code writting<br>
The simplest way is put the calendar control on your form and make it in-visible <br>
in Properties of calendar &quot;Visible&quot; = NO<br>
then create button to view your calendar thingy<br>
In the &quot;On_click&quot; event of the button put your Calendar.visible = true<br>
<br>
here is my example<br>
------------------------------<br>
Private Sub cmd_PickADate_Click()<br>
On Error GoTo Err_cmd_PickADate_Click<br>
<br>
ActiveXCtl12.Visible = True<br>
ActiveXCtl12.Value = Format(Now, &quot;mm/dd/yy&quot;)<br>
'ActiveXCtl12.Value = Format(me!SomeDate, &quot;mm/dd/yy&quot;) '&lt; Specific date of a textbox on your form<br>
<br>
Exit_cmd_PickADate_Click:<br>
Exit Sub<br>
<br>
Err_cmd_PickADate_Click:<br>
MsgBox Err.Description<br>
Resume Exit_cmd_PickADate_Click<br>
<br>
End Sub<br>
-----------------------<br>
Then I'm not sure which event close's it gracefully I'm working on that now.<br>
The Exit event only trips when you click on some other item on your form.<br>
But when you find it add this code there<br>
<br>
Private Sub ActiveXCtl12_Exit(Cancel As Integer)<br>
Me!Text14.SetFocus<br>
Me!Text14 = ActiveXCtl12.Value<br>
ActiveXCtl12.Visible = False<br>
End Sub<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
I'm currently working on inserting the calendar control into a form that's activated from a button next to the date field. Am using the concept of changing the visible property of the calendar, but having trouble controlling it. Did anyone every find the &quot;graceful&quot; way to close the calendar and return control to the date field on the form? [sig][/sig]
 
Hi,
I don't know if this control is available to everyone. I have it because it comes with Visual Basic 6 Professional Edition, but it can be used in Access too (obviously). The ActiveX control is the &quot;Microsoft Date and Time Picker Control, version 6.0&quot; from the &quot;Microsoft Windows Common Controls-2 6.0 (SP3)&quot; found in the &quot;MSCOMCT2.OCX&quot; library file. This is a text box style control that allows the user to enter a date and pops up a calendar if necessary (all of the hiding/showing is done for you) - it kind of looks like a combo box because the calendar is displayed where the drop down list would be. I am sure that you can download this from Microsoft.com as service pack 3 or something. [sig]<p>Rob Marriott<br><a href=mailto:rob@career-connections.net>rob@career-connections.net</a><br>[/sig]
 
Thanks Rob. I found the library on my computer, but when I tried to add the control to my form, it told me that I didn't have the proper license to use the Active X control. [sig]<p>John B<br><a href=mailto:dad2mads@home.com>dad2mads@home.com</a><br>[/sig]
 
Using the mscal.ocx control on the form, I have no trouble hiding the control after the focus moves off the control. I set focus to the date field text box and then hide the calendar control where using the following code:


Private Sub oleCalBegDate_LostFocus()
dtmBegDate.SetFocus
End Sub

Private Sub dtmBegDate_GotFocus()
'Losing Focus on oleCalBegDate sends focus to dtmBegDate
'Hide the oldCalBegDate object
Me.oleCalBegDate.Visible = False
End Sub

I also want the control to disappear when the user double clicks on the date. I tried the following code:

Private Sub oleCalBegDate_DblClick()

dtmBegDate = oleCalBegDate.Value
Me.dtmBegDate.SetFocus

End Sub


Access produces a 2110 run time error saying it can't move the focus to dtmBegDate. Any ideas why I can set focus to the dtmBegDate in oleCalBegDate_LostFocus() but not in oleCalBegDate_DblClick()?
[sig]<p>John B<br><a href=mailto:dad2mads@home.com>dad2mads@home.com</a><br>[/sig]
 
How to put DatePicker control into field in grid subform?
[sig][/sig]
 
Hi,
I think I have found a solution for those of you who get a licencing message when trying to register the &quot;DateTimePicker&quot; control in the MSCOMCT2.OCX library. I searched Altavista.com with this criteria:

+&quot;DateTimePicker Control&quot;

and found this web address:


where you can download a free copy of the &quot;DateTimePicker&quot; control. Download &quot;vcdtp.zip&quot; and extract it into your C:\Windows\System&quot; directory. Register the file &quot;vcDateTimePicker.ocx&quot; and then select the vcDateTimePicker control. I tried this on a computer that only had Access on it (no Visual Basic 6 files...), the control appeared to be a size-able gray box in design view, but when I switched to form view the control was the same as the one in MSCOMCT2.OCX and fully functionable. Give it a try, as I said it takes care of the hiding and showing of the calendar for you! [sig]<p>Rob Marriott<br><a href=mailto:rob@career-connections.net>rob@career-connections.net</a><br>[/sig]
 
Hi,
In my last post I listed a website where you can get a free copy of the DateTimePicker control. While this last control works, I found that it does not have a control source property, thus you cannot directly link it to a field. So, I went out and found one that is both free AND has a control source property! You can download this control from:


It is the Date/Time Picker (VB5 version). Don't worry about having VB5... you simply want the &quot;ccrpDtp.ocx&quot; file contained in the zip file. Just register this in Access. You can use the arrow keys to change the individual parts of the date, or you can use the drop down calendar control. This is a really great control! [sig]<p>Rob Marriott<br><a href=mailto:rob@career-connections.net>rob@career-connections.net</a><br>[/sig]
 
Rob, thanks for all of your help and research. I downloaded the VB5 Date/Time Picker, but I didn't see the control source property. Am I missing something? Also, do you know if there is anyway to allow the user to enter the month / day / year without having to move between the different parts of the date with arrow keys. If this control could do that too, it would be perfect - serving both the users that want to enter their date and those that want to pick it with the mouse. I'm probably being to picky. Thanks again!

Rookie Programmer
[sig]<p>John B<br><a href=mailto:dad2mads@home.com>dad2mads@home.com</a><br>[/sig]
 
Hi,
I went and checked in Access 97 and you are correct; there is no control source property. I use Access 2000 now and I am quickly noticing many changes between the 2 versions. For some strange reason there is a control source property in Access 2000! I don't know anything more about this particular version of the control. I don't have any use for this type of control, but I do have the &quot;real&quot; (original) one from Visual Basic 6 (as I mentioned above), I noticed slight differences between the 3 versions that I have mentioned in this thread. The Microsoft version is the best; it allows you to enter the date the way you want (I think). [sig]<p>Rob Marriott<br><a href=mailto:rob@career-connections.net>rob@career-connections.net</a><br>[/sig]
 
Hope your still around Dougp,

I am reviving this thread because I am having a problem with the date time picker (minor but annoying).

I am able to grab the user selected date out of the picker by putting an event in my code for the controls &quot;closeup&quot; event and this works great.

what is annoying however is that when the picker is first displayed on the form it displays the date found in the &quot;value&quot; property of the control. In my current case, this is : 11/04/2001 (which happens to be the date I put the control on the form and first tested it).

So, when the user drops the calander down, the month first displayed is always is 11/2001 and the user is forced to tab the months forward to get to the current month.

I want the control to be &quot;initialized&quot; to the current month and so, figured i could do this in code........ so, after getting errors from the picker when trying to change it's &quot;value&quot; in my forms load event, i searched and found this thread.

Doug, your example shows the following to init the control:
ActiveXCtl12.Value = Format(Now, &quot;mm/dd/yy&quot;)

when i try this, I get an error &quot;2763&quot;, &quot;Dtpicker returned the error, an error ocurred in a call to the windows date and time picker control&quot;

Doug if your out there perhaps you (or someone else that has solved this annoyance) can help ?

thanks
Paul
 
Whoa !

Never mind, I figured it out........ since i had the control visible property set to false when i tried to set the current date in the control's value I got the error.

i changed the load event to make the control visible, then set it's .value then set it's property back to visible = false and it worked fine (seems it does not like to be toyed with when it's visible property is set to false!)


btw, here is the code i use to get it's value when the user clicks on the date they want (where &quot;RsvToDate&quot; is a bound text box on my form); seems the &quot;closeup&quot; event fires when the user clicks on a date in the dropdown calandar :

Private Sub ActiveXCtl109_CloseUp()

Me.RsvToDate = Format(ActiveXCtl109, &quot;short date&quot;) ' could use &quot;long date&quot; too

end sub


Paul
 
I've found the answer to my question before but have since lost & forgotten it.

How to you get the Calendar Control to open with the current date?

I tried DougP's code

ActiveXCtl4.Value = Format(Now, &quot;mm/dd/yy&quot;)

in the Form_Open event code but I get an error &quot;You can't assign a value to this object&quot;

The value property won't accept anything but a literal date.
 
DK77,

Private Sub Form_Load()
' Enter parameters in BeginningDate and EndingDate text boxes when
' form is loaded.
Me!SelectDate = VBA.Date

End Sub

This assumes that your control is named SelectDate

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
I want to create a daily and weekly planner and i want to use the microsoft calender control!I want to know if its possible for me to click on a certain date and put plans for that day!For instance i want to view the things i have to do tomorrow!
 

I have a question in reguard to an Access Database '2002', calender. I have several pieces of items in my department which are reserved on a note pad, and now I would like to have then done on a calender in Access where everyone can see the reservations without looking for the note book which has been lost a couple of times. We have department (X3) Laptops, LCD Projector, etc; so what I would like to do is have form which has the Calendar on it, and then when a date is clicked another form shows the hours in the day 12am to 12pm. Then the user can highlight the hours they want and type in what they have reserved. Thus other users can see what has been checked out, where it is being used and for how long.

Is this possible?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top