Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Have to use forced TableUpdate()
Message
De
08/02/2008 09:19:47
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Have to use forced TableUpdate()
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01290779
Message ID:
01290779
Vues:
51
In an Add/Edit button on a form, after the class code runs - DODEFAULT() - to add/edit and save a record, I have to populate some fields. I can't do it before that point as there is no new record prior to the DODEFAULT() to populate. This means I have to issue a forced TableUpdate in order to commit the changes.

Is the solution to somehow have the class set a property if the TableUpdate in the class was successful? Then TableUpdate() in the local code if that was .T. or TableRevert() if it was not?
* This is the class code that handles adding/saving/tableupdate for the buffered table
DODEFAULT()

* Default Values for this Appointment Type populated if Adding or Editing
REPLACE ;
	AppointmentTypeSets.Rem_Code WITH THISFORM.RemarkCode, ;
	AppointmentTypeSets.ApptType WITH THISFORM.ApptType, ;
	AppointmentTypeSets.F_Red WITH THISFORM.F_Red, ;
	AppointmentTypeSets.F_Green WITH THISFORM.F_Green, ;
	AppointmentTypeSets.F_Blue WITH THISFORM.F_Blue, ;
	AppointmentTypeSets.B_Red WITH THISFORM.B_Red, ;
	AppointmentTypeSets.B_Green WITH THISFORM.B_Green, ;
	AppointmentTypeSets.B_Blue WITH THISFORM.B_Blue, ;
	AppointmentTypeSets.S_Offr WITH THISFORM.Office, ;
	AppointmentTypeSets.S_Coder WITH THISFORM.Room, ;
	AppointmentTypeSets.S_RmName WITH THISFORM.RoomName, ; 
	AppointmentTypeSets.ChangedBy WITH THISFORM.cUserID

* We are only Adding, not Editing, but DODEFAULT() sets the EditMode flag back to .T.
IF THIS.Parent.EditMode = .T.

	* Only when adding do we populate the CreatedBy field
	REPLACE AppointmentTypeSets.CreatedBy WITH THISFORM.cUserID

ENDIF

* Got to have this to get rid of Uncommited Changes issue because of changed field values
=TABLEUPDATE(.T.,.T.)
Répondre
Fil
Voir

Click here to load this message in the networking platform