Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View Problem in 2º update
Message
 
 
To
12/06/2000 18:42:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00379551
Message ID:
00379619
Views:
30
João,
Because you are using an APPEND FROM to add records to the view, VFP treats these as new records and inserts them into the underlying table when you issue a tableupdate.

How are you initially populating your view? I suggest you make it a parameterized view and requery it so you don't have to deal with the new record problem.
create sql view myview as ;
   select distinct *;
      from jbfic!familias A ;
      left outer join jbfic!familiascli B ;
      a.c_codigo = b.c_codigo ;
      where b.c_codcli = ?CodCli ;
      order by a.c_codigo
Then you could requery the view after you set the CodCli variable.
use myview nodata
CodCli=thisform.text1.value
requery("myview")

HTH.

>Hi all,
>
>I have a simple form, with a grid based in a view that i can edit, in the first time everything works ok, but if a call the same client in the second time, when i do tableupate() it save's another group of records when what i want is the replace of the records that exist and the append from the new ones,
>
>There is the code from my textbox lost focus,
>
>CodCli=thisform.text1.value
>if val(CodCli)<> 0
>select distinct *;
>from jbfic!familias A ;
>left outer join jbfic!familiascli B ;
>on b.c_codcli = CodCli ;
>and a.c_codigo = b.c_codigo ;
>order by a.c_codigo ;
>into cursor CUR1
>go top
>select CLI_FAMILIAS
>append from dbf('cur1')
>go top
>thisform.grid1.refresh()
>ThisForm.Grid1.Column3.Text1.setfocus
>endif
>
>There is the code in my save bottom
>x=TableUpdate(1,.T.,'cli_familias') && Actualiza View
>If x=.t.
>=messagebox('View OK')
> else
>aerror(joao)
>messagebox(joao[2])
>=messagebox('View Fail')
>=tablerevert()
>endif
>CodCli='00000'
>requery('cli_familias')
>thisform.grid1.refresh()
>thisform.text1.value=""
>thisform.text1.value=''
>thisform.text1.enabled=.t.
>thisform.text1.setfocus
>
>Thank's in Advance
>
>João Batista
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform