Tom,
Add the NOFILTER option to the SELECT command. What is happening now is that the SELECT command is causing VFP to use the table again and set a filter on it, but once the routine that does the SELECT command ends the ldEndDate variable goes out of scope and when VFP tries to apply the filter there is an error.