On Aug 10, 2006, at 2:18 PM, Terry Ford wrote:
Here's my code for EditField2's GotFocus event:
Dim d As New date// Add NEW
Dim b As boolean
b=parsedate(editfield1.text,d)
// Check the parsed date for incorrect entry. That's why it's a
Boolean. :)
If b <> True Then
MsgBox "Invalid Date format!"
EditField1.SetFocus//Go back to fix date
Return// Abort rest of event
end if
If d.DayOfWeek <> 7 Then // 7 is Saturday
MsgBox "That is not a Saturday"
editfield1.text=d.ShortDate
Else
// was a Sat., update display to a longdate
editfield1.text=d.LongDate
End If
Here's even better written code:
Dim d As new date
Dim b As boolean
b=parsedate(editfield1.text,d)
If b <> True Then
MsgBox "Invalid Date format!"
EditField1.SetFocus
Else
If d.DayOfWeek <> 7 Then
MsgBox "That is not a Saturday"
editfield1.text=d.ShortDate
Else
// was a Sat., update display to a longdate
editfield1.text=d.LongDate
End If
End If
Terry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>