Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tom Saddul
  Where is Tom Saddul?
 Paranaque
 Philippines
 Tom Saddul
 To: Ernesto Paez
  Where is Ernesto Paez?
 ft lauderdale
 Florida - United States
 Ernesto Paez
 Tags
Subject: RE: How to make an Edit Button to work in
Thread ID: 372222 Message ID: 373890 # Views: 58 # Ratings: 0
Version: Visual FoxPro 5 Category: Forms
Date: Thursday, March 28, 2013 3:41:00 PM         
   


> >
> > It would be better that the form is attached here in a zip format. That way, we can step in to its events and methods easily.
> >
> > http://sandstorm36.blogspot.com
> > http://weblogs.foxite.com/sandstorm36
>
>
>
> Hi Jun,
> Sorry i have been very busy but i want to send you the project file so maybe you can help me out as you told me, all that i want to accomplish in the form that i have in this project is to
> 1- add and edit button to edit a record in that form
> 2- Make sure that my cancel button is capable to undo an Entry if i decide to cancel a new entry, i have been trying to do this w/o asking you but the combination of cursorsetpro(buffering, 5, 'datatest'), set multi on, and tablerevert(.t.) is not working for me, i am pretty sure you can help me out w/o redoing the whole form
> 3- also i realized when i select the new button, where in the click event i have append blank, even when i press the cancel button in the middle of the new data entry, still the record is appended, the only way to get rid of this record appended is adding in the cancel button a delete record command, i don't want that , i want this to work as if i decide to revert the process, that that record does not get appended
> I am giving you in advance what are my issues, i will send you the project file, please let me know besides the project file what else you will need ?
> Regards
> Ernesto

Just another solution I've been using for many years - Detach your form controls from your data fields. Try to think of how you can build your logic using these methods in your form:

InitControls() - This will simply assign empty values to form controls (it does not append record to the data)
SetControls() - This will set the form controls values from an object
GetControls() - This will retrieve values from your form controls and
save them to an object
NewRecord() - Appends a new record to the table using values from the object's properties,
UpdateRecord() - Updates the current record from the object's properties.

You have to create an object which acts as the buffer or bridge between your controls and your table's record. The NewRecord and UpdateRecord should be methods of the object but you can put them in the Form for the meantime.

You should still be using VFP's buffering feature if you are using VFP tables but the logic itself gives you a higher level of control on top of buffering where you don't even need to call the TABLEREVERT()

ENTIRE THREAD

How to make an Edit Button to work in Posted by Ernesto Paez @ 3/6/2013 4:13:09 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 3/7/2013 12:01:46 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/7/2013 10:09:57 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/8/2013 8:09:45 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 3/11/2013 4:36:59 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/11/2013 5:59:55 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 3/11/2013 11:23:18 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/12/2013 2:29:16 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/28/2013 3:04:56 PM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 3/28/2013 3:41:00 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 3/28/2013 7:41:29 PM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 3/29/2013 8:47:24 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/1/2013 6:11:22 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/1/2013 9:12:34 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/1/2013 9:30:39 PM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/2/2013 6:11:44 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/2/2013 2:28:16 PM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/4/2013 4:44:20 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/4/2013 6:48:52 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/16/2013 9:52:39 AM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/16/2013 10:36:30 AM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/17/2013 2:41:52 AM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/17/2013 6:44:59 AM
RE: How to make an Edit Button to work in Posted by Glen Villar @ 4/17/2013 3:13:04 AM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/17/2013 6:45:50 AM
RE: How to make an Edit Button to work in Posted by Glen Villar @ 4/17/2013 6:51:27 AM
RE: How to make an Edit Button to work in Posted by Tom Saddul @ 4/17/2013 7:00:03 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/4/2013 3:19:37 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/5/2013 12:38:54 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/5/2013 1:07:31 AM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/5/2013 2:38:00 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/5/2013 2:16:01 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/5/2013 3:43:49 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/5/2013 1:04:00 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/5/2013 2:33:56 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/6/2013 1:11:18 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/6/2013 1:59:50 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/8/2013 1:15:41 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/8/2013 2:24:17 PM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/9/2013 12:31:25 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/9/2013 12:44:18 AM
RE: How to make an Edit Button to work in Posted by Jun Tangunan @ 4/9/2013 1:51:04 AM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/9/2013 6:47:34 PM
RE: How to make an Edit Button to work in Posted by Ernesto Paez @ 4/9/2013 6:51:09 PM