Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Error Message Invalid Date

Error Message Invalid Date

Error Message Invalid Date

Please help the experts,

I use VF.9 and try the following code:
vardate = ctod (" - - ")
@ row, col get vardate

When incorrectly entering the vardate, there is an error message Invalid Date (press space) below the screen position. The error message is different if I use VFP.6 where error message in an dialog box which looks better and standard
Please advise if the "error message" in VFP 9 is a bug? If it's a bug, how do I customize it.

Thank you.

RE: Error Message Invalid Date

Why should you initiate the variable by ctod() ?

Just declaring vardate = {} will be enough.

And the error message you said looks odd. Was that the exact error message? Or was it Date/datetime evaluated to an invalid value ? (This too displays a dialog box.)

By your question, I guess that it should be a text field which later converts into a date field, and the error message is shown in the status bar through the 'message' clause or 'error' clause of @... get command.

RE: Error Message Invalid Date

No, of course it's not a bug. You enter an invalid date. You get a message saying that it is an invalid date. How can that be a bug?

You ask how you customise the message. You set up your own error-handler, which traps the relevant error, after which you can take whatever action you wish.

But a far better approach would be to ditch @ .. GET and READ completely, and do the whole thing with a VFP form. Judging by the wording of your question, you appear to have moved from VFP 6.0 to 9.0, which suggests you have been using the product for some time, which further suggests that you should have had time to learn how to use Visual Foxpro rather than trying to maintain your old code.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Error Message Invalid Date

Yes, Mike is correct "Invalid Date" message is not a bug. It is an error message from Foxpro when user enters incorrect date.

As you are using "@ row, col get " commands for accepting values from user, You can use VALID clause along with "@ row, col" to customize/Handle error message. But if the variable "VARDATE" is of DATE datatype then "Invalid Date" message will come when user enters wrong date.

Mukesh Khandelwal

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close