Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot update the cursor
Message
From
27/07/2003 05:25:10
 
 
To
27/07/2003 05:02:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00813878
Message ID:
00813881
Views:
7
I have a table paysort fields id and descript (Example of descript is Check, Cash, Credit...).
I have a form with grid that the control source is cursor 'paysort1'.
I fill the cursor by select descript from the table.
I have three buttons on the form Add/Delete/Save.
The add and delete allowing the user to play withe the grid (=cursor) and the user can save the new list to the source table.
Here is the code For all the buttons:

Add
select paysort1
go bottom
select paysort1
append blank
go top
ThisForm.Grdpaysort.refresh
ThisForm.Grdpaysort.setfocus
Delete
 cpay=allt(ThisForm.Grdpaysort.Column1.Text1.value)
nanswer=messagebox ('Are you sure that you want to delete '+ chr(13)+;
+ cpay + chr(13)+' from the TEMP list?',4+32+256)
if nanswer=7
return
endif
if seek (cpay,'paysort1','descript')=.f.
messagebox('prob')
endif
delete in paysort1
ThisForm.Grdpaysort.refresh
ThisForm.Grdpaysort.setfocus
Save
select paysort
scan
	if seek (allt(paysort.descript),'paysort1','descript')=.f.
		delete in paysort
	endif
endscan
select paysort1
scan
	if seek (allt(paysort1.descript),'paysort','descript')=.t.
		loop
	endif
	select paysort
*	go bottom
append blank
insert into paysort values (addtableid('PAYSORT'),paysort1.descript)
endscan
*end transaction
ThisForm.Grdpaysort.refresh
The addtableid function
function addtableid
lparameter ctablename
select tableids
locate for allt(ctablename)==alltrim(tableids.tablename)
iid=tableids.tableid
replace tableid with tableid+1 in tableids
return iid
endfunc
Thank you
Chaim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform