Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Tips On Functions For Evaluating Valid Dates In Text Boxes

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hi,

I have a form which prompts a user to enter a starting and ending date into two text boxes which are then used for a report. How can I evaluate the contents of the text boxes to ensure the user actually entered real (valid) dates before the report fails to produce results?
 
See following validation function. You can also specify '{}' as initial value of textbox, so textbox will work in 'date type' mode, making all validation using built-in VFP ways.

lc__Error = ON('ERROR')
ON ERROR m.lError = .T.
m.lError = .F.

m.lResult = .T. && suggestion

m.dResult = CTOD(thisform.txtDatFrom.Value)
if m.lError or empty(m.dResult)
=messagebox("Date From is invalid!")
m.lResult = .F.
endif

...........

ON ERROR &lc__Error

return m.lResult


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top