Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extra records deleting
Message
From
31/01/2009 19:40:03
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01378618
Message ID:
01378633
Views:
11
>>>>I'm using a command button to delete files in a table. The "invoice" to delete is entered into the textbox value. The command works and the file is deleted, except it will mark 1 to 5 additional files with it. The additional files deleted are not related to the text1.value.
>>>>
>>>>What am I missing?
>>>>
>>>>In the click command I have the following:
>>>>
>>>>CLOSE DATABASES
>>>>
>>>>USE order1
>>>>
>>>>DELETE from order1;
>>>> WHERE thisform.text1.Value = order1.invoice
>>>>
>>>>
>>>>Thank you,
>>>>Dan
>>>
>>>Is, by any chance, order1.invoice char type?
>>>If so check your SET ANSI setting (and SET EXACT - this is not related to SQL commands)
>>>Also when you use such commands like DELETE and UPDATE I'll suggest you to use [==] not just [=]
>>>That means exactly equal.
>>>Check SET EXACT on the HELP for more description what is the difference.
>>
>>Thanks Borislav
>>
>>Order1.invoice is set to character type
>>
>>I may be wrong but I don't believe ANSI would matter since I'm deleting exact invoice numbers such as "234999"
>
>You are wrong.
>hat length order1.invoice has?
>
>>
>>I've changed the = to == but the command still marks the correct and also the oldest record for deletion also.
>>
>>Very odd, never seen this before.
>
>What happens if you try this:
>
>lcInvoice = PADR(ALLTRIM(thisform.text1.Value), LEN(order1.invoice))
>
>DELETE from order1;
>WHERE order1.invoice == m.lcInvoice
>
>
>or even:
>
>*** That is not optimizable
>DELETE from order1;
>WHERE ALLTRIM(order1.invoice) == ALLTRIM(thisform.text1.Value)
>
Thanks Bosislav,

I had placed thisform.text1.value = ' ' in the forms init to clear the box for the number entry. I believe that was the problem. I'm thinking the textbox was retaining the first record and the new record and deleting both. Removing the command worked. I've added the alltrim also as you suggested.

Do you have a suggestion for clearing the textbox value? Since the textbox control source is the table, the textbox populates with the first record. Leave the control source blank and the delete command doesn't read the entry.
Previous
Reply
Map
View

Click here to load this message in the networking platform