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 boxes are not updated in a form

Status
Not open for further replies.

iara84

Systems Engineer
Oct 25, 2022
13
CO
when creating a new customer record when saving data from form2, form1 is not updated.

form1_tkjtsx.jpg


this code is in the init of form1

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
USE clientes IN 0 again

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

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

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

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

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

form2_pc9g3r.jpg


the new button opens form2, this is the code of the save button

Append Blank
Replace nombre With ThisForm.TxtNomCli.Value, identifica With ThisForm.TxtIdent.Value, direccion With ThisForm.TxtDirec.Value, telefono With ThisForm.TxtTele.Value
thisform.release
 
Well, yes,

With our relations you all make it depend on customers1 being on record 1 so relations with RECNO()+1 to +3 work

When you append a new record you also put the record pointer there. And there are no records following the last record.

Your idea to drive 4 sets of controls with this relation is not at all a stable or good solution to the problem, your design is simply not what you'd do with VFP at all. It's futile to insist on finding something that works with multiple controls and workareas when you simply can use the grid.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top