Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Have to use forced TableUpdate()
Message
From
08/02/2008 09:19:47
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Have to use forced TableUpdate()
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01290779
Message ID:
01290779
Views:
53
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.)
Reply
Map
View

Click here to load this message in the networking platform