Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TABLEUPDATE(.T.) bombs with uncommitted changes
Message
From
01/10/2003 19:54:23
 
 
To
01/10/2003 07:47:34
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00833421
Message ID:
00834037
Views:
28
Hi Marcia,

Thank you very much for your great help! That code will heplp me a lot!

Thanks again,

Luis


>Hello Luis.
>
>Your solution doesn't work when the textbox is in a grid. Do you know how to solve this case?
>
>What I do is add a method called WriteBuffer to my data aware form class. The save button in the tool bar calls _Screen.ActiveForm.Save() which, in turn, calls WriteBuffer(). This code in WriteBuffer():
>
>
>LOCAL loColumn, loActiveControl, loControl, llRetVal
>
>llRetVal = .T.
>IF TYPE( 'Thisform.ActiveControl.Name' ) = 'C'
>  loActiveControl = Thisform.ActiveControl
>  IF UPPER( loActiveControl.BaseClass ) # 'GRID'
>    *** If there is code in the valid method of the active control
>    *** And the entry is invalid, the error message will display
>    *** But the rest of the code code will continue to run and save
>    *** the bad data anyway. So we cannot just issue a SetFocus()
>    IF NOT EMPTY( loActiveControl.Valid() )
>      *** We still have to cause the Valid to fire to update the data
>      *** from what is in the buffer because the previous line
>      *** does not cause the Valid to fire, it merely runs any code
>      *** in that method
>      loActiveControl.SetFocus()
>      llRetVal = .T.
>    ELSE
>      llretVal = .F.
>    ENDIF
>  ELSE
>    FOR EACH loColumn IN loActiveControl.Columns
>      IF loActiveControl.ActiveColumn = loColumn.ColumnOrder
>        loControl = EVAL( 'loColumn.'+ loColumn.CurrentControl )
>        IF NOT EMPTY( loControl.Valid() )
>          loControl.SetFocus()
>          llRetVal = .T.
>        ELSE
>          llRetVal = .F.
>        ENDIF
>        EXIT
>      ENDIF
>    ENDFOR
>  ENDIF
>ENDIF
>
>RETURN llRetVal
>
Previous
Reply
Map
View

Click here to load this message in the networking platform