| {\rtf1\ansi\ansicpg1252\deff0\deflang1044{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} \viewkind4\uc1\pard\f0\fs17 Unfortunately, the VB Date Picker control doesn't allow you to enter null dates. To overcome this limitation try using the following work around: \par \par You will need a form with a Date Picker control on it called DTPicker1 and a CommandButton called cmdOK. Note, you must add the "Microsoft Windows Common Controls 2-6.0" (MSCOMCT2.OCX) component to your project to use the Date Picker. \par \par Option Explicit \par \par Private Sub cmdOK_Click() \par Dim sMyDate As String \par \par If Me.DTPicker1.Format = dtpShortDate Then \par sMyDate = Me.DTPicker1.Value \par Else \par sMyDate = "null" \par MsgBox "You have not selected a date..." \par End If \par End Sub \par \par Private Sub DTPicker1_CloseUp() \par Me.DTPicker1.Format = dtpShortDate \par End Sub \par \par Private Sub DTPicker1_KeyUp(KeyCode As Integer, Shift As Integer) \par If DTPicker1.Visible Then \par If KeyCode = vbKeyDelete Then \par DTPicker1.Format = dtpCustom \par DTPicker1.CustomFormat = " " \par Else \par DTPicker1.Format = dtpShortDate \par End If \par End If \par End Sub \par \par Private Sub Form_Load() \par Me.DTPicker1.Format = dtpCustom \par Me.DTPicker1.CustomFormat = " " \par End Sub \par } |
Entering blank dates in a Date Picker control |
India web developer web development India | India web development company India ecommerce web developer