ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date / time picker error (https://www.excelbanter.com/excel-programming/341683-date-time-picker-error.html)

Mark

date / time picker error
 
I am using 2 date / time pickers in a userform.

This userform has a multipage with 4 pages (the date / time pickers are on
page 3).

Currently, I have code specifying what value the date/time pickers should go
to by default (the first is set to the first day of the current year and the
second is set to today).

With UserForm1
.DTPicker1.Value = DateSerial(Year(Date), 1, 1)
.DTPicker2.Value = DateSerial(Year(Date), Month(Date), Day(Date))
End With

The code to set the default value is part of the userform_initialize event.
However, when the event runs, I get an error stating "An error occured in a
call of the windows date and time picker control." So, the two controls end
up having values of 1/1/1900.

So, to see what the issue was, I put a button on the userform to update the
date / time picker values using the same exact code as I used in the event
initialize event. This works! However, I can't have users clicking buttons
to update what should be default values.

Any ideas? Is there a multipage select event? Any other way I can have
them automatically update without having the user do the work?


All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com