Pop-up Calendar Set today's date

D

dsc2bjn

I have a calendar control which i have tied to another control. I have set
the calendar to appear when you "mouse down" on the control. I am trying to
get the calendar to default to today's date, if there is a value for the date
control. Right now the date defaults to the date the calendar control was
added to the screen.

What did I do wrong?

Private Sub Original_Date_Calendar_Click()
' Set Date to the selected date and hide the calendar.
Original_Date.Value = Original_Date_Calendar.Value
Original_Date.SetFocus
Original_Date_Calendar.Visible = False
End Sub
Private Sub Original_Date_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
' Show Calendar and set its date.
Original_Date_Calendar.Visible = True
Original_Date_Calendar.SetFocus
' Set to today if OrderDate has no value.
Original_Date.Value = IIf(IsNull(Original_Date), Date, Original_Date.Value)

End Sub
 
D

dsc2bjn

Thanks!!!

That works, but why doesn't this line work?
' Set to today if OrderDate has no value.
Original_Date.Value = IIf(IsNull(Original_Date), Date, Original_Date.Value)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top