Well, check out SET ANSI and SET EXACT settings. Also could be that record in MAIL_BODY was somehow deleted and you don't see it?
Try also the same function but using SEEK instead of SQL. Would you have the same result?
Last resort - re-index the tables.
>Nadya,
>
>>
>> I agree with Borislav...
>>
>
>I also had the idea of flipping the "ON"-Statement but it did not appear to me as a solution as it's working in most cases. Last night, after I wrote the question, about ten mails were created and sent out flawlessly.
>
>I can display (uses the same function) EVERY mail that comes in via the COM-Server. Only the COM-Server sometimes does not "see" the body-record when sending the mails. And when he does not see the record, he does not on the next run, which is five minutes later.
>
>
>> ...and also avoid using single letters like a and b, put ml for
>> MAILS and mb for MAIL_BODY or use these names as they are.
>
>Hmmmm.... I would never do
>
>
>use MAIL alias A in 0
>use MAIL_BODY alias B in 0
>do something
>
>
>but I never had an issue about using single letter LOCAL aliases (that is within a SQL-Statement) in about ten Years FoxPro. Do You have more info on that (link to a document or so)?
>
>>
>> ... Also is your ID a character field?
>>
>
>Yes, it's Char(10) and fully filled or not existing. PK on MAILS. Looks something like this "T000010527"
>
>I'll try Boris' and Your hints but I'm afraid it's something different.
If it's not broken, fix it until it is.
My Blog