Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text box data is not deleted

Status
Not open for further replies.

iara84

Systems Engineer
Oct 25, 2022
13
CO
form1_ewmfk8.jpg


This is the code for the delete button

SET DELETED ON

IF Messagebox( "Estás seguro?", 4 ) = 6
DELETE
ThisForm.txt
ENDIF


this is the code of the txt method

USE clientes IN 0 alias customers1
use clientes IN 0 again alias customers2
use clientes IN 0 again alias customers3
use clientes IN 0 again alias customers4

SELECT customers1
SET RELATION TO ;
RECNO()+1 INTO customers2, ;
RECNO()+2 INTO customers3, ;
RECNO()+3 INTO customers4 IN customers1

scan
thisform.TxtNomCli1.ControlSource="customers1.nombre"
thisform.TxtIdent1.ControlSource="customers1.identifica"
thisform.TxtDirec1.ControlSource="customers1.direccion"
thisform.TxtTele1.ControlSource="customers1.telefono"
ENDSCAN

scan
thisform.TxtNomCli2.ControlSource="customers2.nombre"
thisform.TxtIdent2.ControlSource="customers2.identifica"
thisform.TxtDirec2.ControlSource="customers2.direccion"
thisform.TxtTele2.ControlSource="customers2.telefono"
ENDSCAN

scan
thisform.TxtNomCli3.ControlSource="customers3.nombre"
thisform.TxtIdent3.ControlSource="customers3.identifica"
thisform.TxtDirec3.ControlSource="customers3.direccion"
thisform.TxtTele3.ControlSource="customers3.telefono"
ENDSCAN

scan
thisform.TxtNomCli4.ControlSource="customers4.nombre"
thisform.TxtIdent4.ControlSource="customers4.identifica"
thisform.TxtDirec4.ControlSource="customers4.direccion"
thisform.TxtTele4.ControlSource="customers4.telefono"
endscan

I only delete a record from the cursor but not from the client table, when I close the project it returns and the data before deleting appears.
 
Select the table before DELETE or write DELETE IN CUSTOMERS1 or whichever alias you want to delete in.

iara84 said:
I only delete a record from the cursor
Which cursror? You are using a table with 4 aliases, all workareas are having the table clientes.dbf file open, not a cursor. Whatever you delete from any of customers1 to customers4 will be deleted from clientes.dbf

Besides that, your relation idea isn't working well and I already told you. If you delete any of these records the relation still is made on the RECNO() and that does not change when one record is deleted, so in fact, one of the relations still points to the deleted record and that doesn't change to the next one after the deleted row.

All that said, you still ignore my advice. I'll stop here, all help I try to give you is wasted. Let alone that all data changes need to be followed by THISFORM.REFRESH()

Chriss
 
I already modified the code of the delete button

SET DELETED ON

IF Messagebox( "Estás seguro?", 4 ) = 6
DELETE
ThisForm.txt
ThisForm.Refresh
ENDIF

remove from method txt scan and endscan

add in the release method this code
SELECT clientes
PACK

but it's still the same, it deletes the record from form1 but it doesn't delete it from the table
 
myself said:
Select the table before DELETE or write DELETE IN CUSTOMERS1 or whichever alias you want to delete in.

Your DELETE deletes one record in whatever is the current workarea and whatever record is the current record.
If you work that imprecise you also get imprecise results.

I already said I stop, You're proving you can't even read one sentence and apply it or at least ask back what I mean with "]Select the table before DELETE".

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top