>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
In addition to Borislav's comments:
- it may not be a good idea to use object properties in a SQL engine command. For sure, they don't work in UPDATE - SQL: see thread#
1264672- normal syntax in SQL is to have
... WHERE Column = Value
rather than
... WHERE Value = Column
I seem to recall some issue with coding the latter way, but I can't find a reference here.
As a side note, for maintenance reasons I don't usually put much code in the events/methods of controls. For example, I would normally create a custom form method called, say, DeleteButtonClick().
The button's Click() method would contain:
=ThisForm.DeleteButtonClick( ThisForm.Text1.Value )
and the custom method would be something like:
LPARAMETERS ;
tcInvoice
CLOSE DATABASES ALL
USE Order1
DELETE FROM Order1 ;
WHERE Order1.Invoice == tcInvoice
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up