General information
Category:
Coding, syntax & commands
>>I created a form with a few text fields that are bound to the fields
>of a table. I am trying to make it multiuser. So i set multilocks to on and
>I do a table buffering (pessimistic - 4 ). However, everytime I edit a
>record and save it, I find that the changes are not saved. Why is that? I
>even tried to display the field values before tableupdate and found that
>the changes are there. The changes disappear after tableupdate.
>>Hope someone can explain what I have done wrong. Thanks.
>
>Check out the TableUpdate() command.
>You need to issue it to save the records.
Hi,
I issue a tableupdate command when the save button is clicked. Basically, my code performs some checking to make sure there are no duplicates and then save the record using tableupdate(.T.). Before tableupdate command is issued I make sure that the correct table is selected. However, I find that the record is still not saved. I believe it is something to do with the table buffering.
Any idea why?
------code inside the save button-------
IF NOT Empty(This.Parent.tAlias) THEN
SELECT (This.Parent.tAlias)
ENDIF
&&validation
WITH THISFORMSET.FORM1.PAGEFRAME1.PAGE1
IF Empty(.fbrcode.Value) THEN
=MESSAGEBOX("Fbr code MUST NOT be blank", 64, "Error")
RETURN
ENDIF
IF Empty(.fbrname.Value) THEN
=MESSAGEBOX("Fbr name MUST NOT be blank", 64, "Error")
RETURN
ENDIF
IF Empty(.commision.Value) THEN
=MESSAGEBOX("commision MUST NOT be 0", 64, "Error")
RETURN
ENDIF
&&check for duplicate fbr code
LOCAL currec
currec = RECNO()
SEEK .fbrcode.Value
IF FOUND() AND RECNO() != currec THEN
=MESSAGEBOX("The fbr code already exists", 64, "Error")
GOTO currec
RETURN
ELSE
GOTO currec
ENDIF
&&everything ok....update table
=TABLEUPDATE(.T.)
.fbrcode.ReadOnly = .T.
.fbrcode.Refresh
.fbrname.ReadOnly = .T.
.fbrname.Refresh
.expenses.ReadOnly = .T.
.expenses.Refresh
.commision.ReadOnly = .T.
.commision.Refresh
ENDWITH
This.Enabled = .F.
WITH This.Parent
.bAdd.Enabled = .T.
.bEdit.Enabled = .T.
.bDel.Enabled = .T.
.bCan.Enabled = .F.
.bPrint.Enabled = .T.
.bClose.Enabled = .T.
ENDWITH
--------end-----------
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only