Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Null Picker


Message #1 by "Kevin Crider" <criderkevin@a...> on Thu, 5 Dec 2002 21:57:39
 hi=0D
=0D
it does become null and empty but how do you enter dates into it by keybo
ard
without invoking the pull-down button=0D
=0D
bharat=0D
 =0D
-------Original Message-------=0D
 =0D
From: professional vb=0D
Date: Friday, December 06, 2002 19:00:53=0D
To: professional vb=0D
Subject: [pro_vb] Re: Null Picker=0D
 =0D
Hi Kevin,=0D
 =0D
An empty datetimepicker control can be achieved in this way.=0D
 =0D
Put a DatePicker and two CommandButtons on a Form and paste this into the
 =0D
Form's code window:=0D
 =0D
Private Sub Command1_Click()=0D
DTPicker1.Value =3D vbNull=0D
FormatDTPicker=0D
End Sub=0D
 =0D
Private Sub Command2_Click()=0D
DTPicker1.Value =3D Now=0D
FormatDTPicker=0D
End Sub=0D
 =0D
Private Sub DTPicker1_Format(ByVal CallbackField As String, _=0D
FormattedString As String)=0D
If CallbackField =3D "X" Then=0D
FormattedString =3D ""=0D
End If=0D
End Sub=0D
 =0D
Private Sub FormatDTPicker()=0D
With DTPicker1=0D
If .Value =3D vbNull Then=0D
=2EFormat =3D dtpCustom=0D
=2ECustomFormat =3D "X"=0D
Else=0D
=2EFormat =3D dtpShortDate=0D
End If=0D
End With=0D
End Sub=0D
 =0D
Now run the program and click the Command1 button; the date text in the =0D
DatePicker control should disappear (because the Value property of =0D
DatePicker is set to vbNull) which is the effect you are seeking. Pressin
g =0D
the Command2 button puts the current date (via the Now function) into the
 =0D
DatePicker control. You will have to play around with when you call the =0D
FormatDTPicker subroutine to account for when and how your dates can be =0D
changed.=0D
 =0D
Good Luck=0D
 =0D
Rini=0D
 =0D
 =0D
 =0D
 =0D
> Hey Pros:=0D
 =0D
> I have a data entry form with 3 date/time pickers on it for date entry.
 =0D
T> he pickers need to be able to accept NO DATE. e.g., one of the dates i
s =0D
f> or a product warranty, if there is no warranty, the date (picker) fiel
d =0D
s> hould be empty. Is there a way to do this? =0D
I> am writing the form as a front end to an old access db, so the project
 =0D
g> ives a binding error when it is executed because some of the d/t =0D
pickers =0D
a> re bound to the blank db fields through an adodc control. Any =0D
suggestions =0D
o> n best workaround using d/t picker?=0D
 =0D
> tia=0D
 =0D
> Kevin=0D
 =0D
---=0D
Change your mail options at http://p2p.wrox.com/manager.asp or =0D
to unsubscribe send a blank email to =0D
 =0D
=2E

  Return to Index