Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tableupdate problem
Message
De
03/05/1998 20:18:25
Daud Mydin
Hwang-Dbs Securities Berhad
Penang, Malaisie
 
 
À
02/05/1998 23:54:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00096471
Message ID:
00096629
Vues:
18
>>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-----------
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform