>>>>>>How would I change the above for VFP database? Does VFP have function similar to the SQL Server's DATEADD()?
>>>>>>
>>>>>>TIA
>>>>>
>>>>>Dmitry,
>>>>>
>>>>>You can GOMONTH(somedate, 12 * number of years) to get years advance (or step back).
>>>>
>>>>Antonio,
>>>>
>>>>Thank you very much! I didn't know of this function. This should do the job.
>>>
>>>How do I make an expression that I could use in the Where clause of the SQL Select (using the GOMONTH() approach). I have been trying many ways but still can't get it without an error.
>>>
>>>Here is one try:
>>>
>>>cWhereExpr = ['] + DTOS( dToday ) [' >= GOMONTH(PurchDate, Years*12 ) ]
>>>
>>>
>>>What is wrong with above?
>>
>>Dmitry, in VFP you must compare a date with a date, or a string with a string.
>>
>>So, either
>>
>>cWhereExpr = "'" + DTOS( dToday ) "' >= DTOS(GOMONTH(PurchDate, Years*12 ))"
>>
>>(in fact,
>>
>>cWhereExpr = "DTOS( dToday ) >= DTOS(GOMONTH(PurchDate, Years*12 ))"
>>
) or
>>
>>cWhereExpr = "dToday >= GOMONTH(PurchDate, Years*12 )"
>>
>
>Antonio,
>Your top choice (with DTOS()) works perfectly! Thank you!!
But the last example will be the fastest.
Tamar