This was a first for me. An application that had been working fine suddenly started throwing a “Function Sequence Error” when retrieving data from a remote view. That error message was a little misleading, as I didn’t have any functions in my view that could even be out of sequence!
Googling around didn’t lead to a direct answer, although plenty of folks have had similar issues with various clients besides Visual FoxPro. (I’m amazed that anyone would take the suggestion of “Reinstall SQL Server” seriously!) There were enough clues in those answers that eventually led me to how to fix this however.
Essentially what’s going on here is that you’re trying to use records in a remote view before Visual FoxPro has completed fetching all the records down from SQL Server. This most often happens when you’ve configured your remote view to only grab a limited # of records at a time. That’s the “function sequence” that’s out of whack.
The easiest thing to do to fix this is to simply tell Visual FoxPro to retrieve all your records in the remote view configuration (Modify View / Query / Advanced Options / check “All” next to “Number of Records to Fetch at a Time”. If that’s not an option you could also trap for this error and keep retrying until all the records are downloaded, but that seems suboptimal.
Hope this helps!