Try that with, say 97/03/01, or May, or July, or...I don't think it works.
You are assuming that the previous month has as many days as the current month.
Try two steps:
lcDate = GoMonth(ldMyDate,1)
lcDate = lcDate - day(lcDate)
This way you are taking advantage of the fact that the FoxPro gomonth() function takes care of the problems with 'uneven' months. For example, gomonth({97/08/31}, 1) gives you {97/09/30}, and you then work with 30 (not 31) for your subtraction.
Take care,
Joe
>>>The easiest way I know:
>>>
>>>lcDate=GoMonth(ldMyDate-day(ldMyDate),1)
>>>
>>>This doesn't depend on SET CENTURY or SET DATE, it works for leap years, etc.
>>
>>Thanks a lot. It does the job perfectly.
>
>Perfectly and excatly! :)
>
>You're welcome.
>
>Vlad
Joseph C. Kempel
Systems Analyst/Programmer
JNC