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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrong Data type with SHORT date

Status
Not open for further replies.

rkolva

Programmer
Jan 16, 2003
127
US
I am having the VFP error dialog poping up stating that "Data/datetime evaluated to an invalid date" instead of the little wait window whenever I enter an incorrect date with a three digit year. This behaviour didn't occur when I had the SET DATE MDY or DMY.

The application issues a set date and also dynamically sets textbox.dateformat to the corresponding numeric date value.

The error dialog only seems to be propogated by an incorrect year. If I key an invalid month or day I get the little wait window. Any ideas.

Ralph

 
It sounds like a problem with your error handling. If you are seeing a WAIT WINDOW after you do anything it is not a default behavior. If you changed the date format and are using some sort of string parsing to determine if a user enters the date in correctly, take a look at that code and make sure it is checking the value in the same order as your date format.

Hope this helps.

-Kevin
 
Thanks for the repsonse,

I'm not parsing a date string and in building a test form with just a textbox set to a date field I get the wait window behavior. Is there something I'm not understanding?

Try the following:

Code:
test = CREATEOBJECT('Form')
test.Visible = .T.

test.addobject('txtDate', 'Textbox')
WITH Test.txtDate
	.Top = 10
	.Left = 10
	.ControlSource = 'TestTbl.testdate'
	.DateFormat = 10 && American
	.Visible = .t.
ENDWITH

test.addobject('txtDate2', 'Textbox')
WITH Test.txtDate2
	.Top = 30
	.Left = 10
	.ControlSource = 'TestTbl.testdate2'
	.DateFormat = 13 && Short
	.Visible = .t.
ENDWITH

CREATE TABLE 'TestTbl' ('testdate' D, 'testDate2' D)
APPEND BLANK

READ EVENTS

Enter 10/32/04 in the first textbox. I get a wait window stating invalid date

Enter 10/10/200 in the second textbox. I get an error dialog. I suppose I could catch the error but I'm trying to understand why the difference in behavior.

Ralph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top