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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2010 Date Picker visible property 1

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
After spending 2 days working with the DTPicker control in Access 2010 to find there were more event properties on the control in the VBA window than in the properties window, I thought I was out of the mire finding On_Change event available to do everything, but now another problem.

All I want to do is set the visible property of the control to false after user selects a date. The control itself (combo appearance) dissapears, but the calandar panel remains open and does not go until you click the form (which is on a tab control)

Anyone seen this?
 
I don't run 2007/2010 as if yet, but I'm under the impression that if the Control is set up so that the DatePicker can be used it appears when the Control has Focus and disappears when it loses Focus. I'm not sure that you can programatically control its visibility.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks. I found the only way to get what I wanted was to use SendKeys which I usually avoid like the plague. I am using the standard date picker control on it's own rather than the inbuilt calendar within a textbox control which needed binding to a table.

To setfocus and dropdown the calendar

Private Sub Dated_Click()
Me.DTPickerA.SetFocus
Me.DTPickerA.Value = Date
SendKeys "{F4}"
End Sub

Calendar opens for user to insert date

Private Sub DTPickerA_Change()
Me.DTA = Me.DTPickerA.Value
SendKeys "{Esc}{Esc}"
Me.V4.SetFocus
Me.DTPickerA.Visible = False
End Sub

Closes and hides the calendar control.

Seems to work well. I used 2 Esc commands to make sure closes.

Any other ideas welcome. Pre Access 2007 was so much easier, just wish I had not removed past editions

Thanks again
 
SendKeys should be avoided like the plague! Why not simply control the Visibility of the DatePicker? I've done that for years.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks, I have never used this control before, always used the ActiveX calendar, but thats been taken out of Access 2010.

I wanted a control to open, allow a date to be picked, close itself after putting the value in a textbox, and move to another control. However I was unable to get what I wanted as the calendar section of the control stayed open, difficult to explain it you have to see it. I never tried it, but maybe I can programatically set the height/width to 0 inches or set its top/left positions so it's out of site. Just wish the original control was there. I have looked at third party forms/controls for calendars but thought I was going backwards. What I have now seems stable, at least I can carry on with other things instead of wasting time.
 
Thankyou, you made me think again about using sendkeys. If I replace the sendkeys line with Me.DTPickerA.Visible = false, it leaves the calendar panel open, however if I replace the line with Me.DTPickerA.width = 0 the calendar totally dissapears. So thanks, you made me try a last resort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top