Add a calendar to a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me how to add a calendar to a comboBox that appears when
user clicks on a the drop down arrow. Thank you, Edward Keith
 
Edward,
A ComboBox can not display a calendar control, only record values from the underlying
table, query, or valuelist.
You can simulate the "action" of a combo by making the height of the calendar toggle up
and down.
Place a small button control on your form, and give it a picture value of a small down
arrow graphic.
Size the height of your calendar control to approx the size of a combo box height, with
the arrow button placed beside it.

In the OnClick event of that button... using example names and value...
If YourCalControl.Height = 400 Then
YourCalControl.Height = 2000
Else
YourCalControl.Height = 400
End if
 
I believe what your trying to do is have a calender "appear" when you click
the drop down button in a combo box. What you have to do is insert the
calendar control onto the form and set it's "visible" property to false. On
the event "mouse down" for the combo change calendar visible = true. the
calender will appbecome visible. next you have to write code in the calendar
control event section to have the value you click on go into the combo box
and reset the calendar visible property to false.
here is code for making calender visible (combobox is named "beginnigdate",
calendar control is named "calendar"
Private Sub BeginningDate_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
'show calendar
'Dim currctl As Control, ctrname As String
Set currctl = Screen.ActiveControl
ctrname = currctl.Name
Calendar.Value = currctl.Value
Calendar.Visible = True
End Sub
************
here is code for putting date in combo box
Private Sub Calendar_Click()
' Set date written to the selected date and hide the calendar.
'MsgBox (ctrname)
'Dt_written.Value = Calendar.Value
'Dt_written.SetFocus
'msgbox (currctl)
currctl.Value = Calendar.Value
currctl.SetFocus
Calendar.Visible = False
Set currctl = Nothing
End Sub
Remember to close the calendar control, because it's not visible doesn't
mean it's close. good luck.
brc
 
Back
Top