Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving of record won't work
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01496386
Message ID:
01496387
Views:
54
>I am using a buffered table and then TableUpdate() to save it. What is weird is that from all appearances and stepping through the code, the NEW record seems to be saved. However, after closing the form and re-opening the form, the newly saved record is always gone. What have I missed? Oh, also, I am using a View to present the data from two tables and saving only the data from one table on the form. I also checked the box in the Local View that says "Send SQL Updates", and then put checkmarks on the fields I wanted to be updateable.
>
>I can see that any changes I make to any existing record do take; they are saved, but NEW appended records are not saved.
>
>Setup code in LOAD event:
>
>USE (.cTable) IN 0 EXCLUSIVE	&& Opens both ORDERS and Customers tables.
>SELECT (.cTable)	&& LV_ORDERS
>* Create indexes for Local View, LV_ORDERS.
>INDEX ON Lic_Plate TAG Lic_Plate
>INDEX ON ALLTRIM(LASTNAME)+ALLTRIM(FIRSTNAME) TAG LFNAME
>INDEX ON VIN TAG VIN
>INDEX ON ORDER_NO TAG ORDER_NO
>SET ORDER TO LFNAME
>
>* Set the buffering to Optimistic buffering.
>SET MULTILOCKS ON
>CURSORSETPROP("Buffering", 5, "lv_Orders")	&& Changes are only made to the ORDERS table.
>* Open other tables, which are used for DropDown Lists.
>USE States IN 0 SHARED
>USE Warranty IN 0 ORDER Warranty SHARED
>
>
>The precise code in my SaveIt() function is:
>
>LPARAMETERS tcTable
>LOCAL llGoodSave
>
>WITH ThisForm
>	llGoodSave = TABLEUPDATE(0,.T., tcTable)
>	IF !llGoodSave
>		WAIT WINDOW NOWAIT "Was not able to save changes."
>	ELSE
>		.newButton.Enabled = .T.	&& Turn New button back on now that data has been saved.
>		*.cmdLetter.Enabled = .T.	&& Turn Letter button back on,...
>		.printButton.Enabled = .T.	&& Turn Print button back on,...
>		.saveButton.Enabled = .F.		
>		.cancelButton.Enabled = .F.
>		WAIT WINDOW NOWAIT "Save was successful!"
>	ENDIF
>ENDWITH
>RETURN llGoodSave
>
This problem may happen if the table is buffered as well (the Orders table).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform