PDA

View Full Version : [SOLVED:] Set Default Date in Datetimepicker using a query



kbsudhir
06-22-2014, 06:43 AM
Hi All,

I am trying to set default date in the DateTimePicker using VBA in access 2007. But I am getting the below error:

Run-time error '2763'
DTPicke returned the error: An error occurred in a call to the Windows Date and Time Picker control

I am able to get the date sucessfully using the query. But not able to pass the same to the DTPicker. I have tried below codes but with same error. :(


TxtBox_Date.Value = rst!Event_Date
DTPicker_EventDate.Value = TxtBox_Date
and

DTPicker_EventDate.Value = TxtBox_Date.Text
and

DTPicker_EventDate.Value = TxtBox_Date.value
and

DTPicker_EventDate.Value = rst!Event_Date

Please guide me on where am I going wrong and what should I do get this fixed.: pray2:

Thanks for all your time and help.

Regards
Sudhir

kbsudhir
06-23-2014, 06:42 AM
I am using Access 2007 on Windows 7 Professional.

Can anyone guide me on this please

kbsudhir
06-23-2014, 08:23 AM
Its done guys.

The right code is:

DTPicker_EventDate.Value = rst!Event_Date

I was getting that error because my DTP was set in Visible = No mode as I was changing the mode after setting the default date. Now I changed it to visible before setting its default date.

Regards
Sudhir