|
-
Feb 18th, 2006, 08:39 AM
#1
Thread Starter
Hyperactive Member
Simple DTPicker Question
Hi all,
1) Can I set a now date for DTPicker value on the properties colunm?
If no, cani have put DTpicker.value = now under the form_load event?
2) What is the best approach to valid if the date1 cannot be less than date2.
Is the below coding good enough or there is a better way.
VB Code:
If DTpicker1 > DTpicker2 Then
MsgBox" You have enter an invalid date" & vbCrLf & "Please try again" , vbinformation, "Invalid Date"
Cancel = true
Exit sub
End if
If DTpicker2 > DTpicker3 Then
MsgBox" You have enter an invalid date" & vbCrLf & "Please try again" , vbinformation, "Invalid Date"
Cancel = true
Exit sub
End if
-
Feb 18th, 2006, 08:57 AM
#2
Frenzied Member
Re: Simple DTPicker Question
1 Yes on form_load
2:
VB Code:
Private Sub DTPicker1_Change()
If DTPicker1 > DTPicker2 Then DTPicker1 = DTPicker2
End Sub
Private Sub DTPicker2_Change()
If DTPicker1 > DTPicker2 Then DTPicker1 = DTPicker2
End Sub
oh1mie/Vic

-
Feb 18th, 2006, 09:04 AM
#3
Thread Starter
Hyperactive Member
Re: Simple DTPicker Question
Hi oh1mie,
1) yes to u can put a now date as a value under the DTPicker property? if yes, may i know where?
If yes by putting under the form event, but whenever a click a new record, it was give a different value e.g. 12/5/05.
2) Sorry, maybe my question isn't clear enough. I like to do a validation on the dates. Date1 is a fixed now date. Therefore date2 cannot be set less than Date1, if yes... prompt a error message to ask user to reenter.
This condition applies to date3 too.
-
Feb 18th, 2006, 09:19 AM
#4
Frenzied Member
Re: Simple DTPicker Question
Right place is Form_Load event
VB Code:
Private Sub Form_Load()
DTPicker1 = Now
End Sub
Question 2
VB Code:
Private Sub DTPicker2_Change()
If DTPicker2 < DTPicker1 Then DTPicker2 = DTPicker1
End Sub
oh1mie/Vic

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|