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

Override date() vfp function

Status
Not open for further replies.

lclock

Programmer
Jan 24, 2009
15
0
0
IT
Hi, i'm looking form a smart solution to solve this problem:
i've a large VFP application that now at the login doesn't ask for a date.
Now i need to ask a date and use it in all point of my application when i use the date() function.
Is it possible to ovveride the vfp standard date() function with a new function that return the login date so that i can get the result without editing 150 program ?
Thanks
 
Nope, you can use Tools->Code References to search and Replace every instance of DATE( TO MyDate(
As You see I didn't close the brackets, that is because DATE function has 3 optional parameters. But if you want to replace only these instances where you use DATE w/o any parameters you should use DATE() and MyDate().

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Thank's
i was hoping in something "like a miracle",
but this is better than nothing.
 
This might be a bit drastic, but there's a nice piece of freeware called RunAsDate that fools VFP (or any other app) into thinking the date is something other than what it really is. Once you've run it, the VFP DATE() function will take whatever date you set at the start.

You can find the program as But be sure to test it carefully, as it might have other implications for your app.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top