Cetin,
Sorry for the long wait on the thank you, I've been away from the thread for the past couple of days.
The info you provided was very helpful. Thanks again!
/Chris
>>>>I've created a view based on an FP table. The view (MyDeliverables) seems to be ok, I can insert, update and delete records through the view from the command line. I've created a form, placed the view in the data environment. Put a grid on the form listing the records from the grid.
>>>>
>>>>** FORM1.Init
>>>>
>>>>THIS.Grid1.RecordSource=""
>>>>
>>>>* Filter Records based on nOSPKey
>>>>SELECT * FROM MyDeliverables WHERE nOSPKey=THISFORM.t_nOSPKey.VALUE INTO CURSOR Q_Deliv
>>>>
>>>>THIS.Grid1.RecordSource="Q_Deliv"
>>>>THIS.Grid1.Column1.ControlSource="Q_Deliv.cAction"
>>>>THIS.Grid1.Column2.ControlSource="Q_Deliv.dDueDate"
>>>>THIS.Grid1.Column3.ControlSource="Q_Deliv.dcomplete"
>>>>
>>>>THIS.Grid1.Refresh
>>>>
>>>>
>>>>Put a delete button:
>>>>
>>>>** FROM1.cmdDelete.Click
>>>>
>>>>SET MULTILOCKS ON
>>>>= CURSORSETPROP('Buffering', 5, 'MyDeliverables')
>>>>DELETE FROM MyDeliverables WHERE nDelKey=Q_Deliv.nDelKey
>>>>* = TABLEUPDATE(.T.)
>>>>SET MULTILOCKS OFF
>>>>
>>>>Put a refresh button:
>>>>
>>>>** FORM1.cmdRefresh.Click
>>>>
>>>>THIS.Grid1.RecordSource=""
>>>>
>>>>SELECT * FROM MyDeliverables WHERE nOSPKey=THISFORM.t_nOSPKey.VALUE INTO CURSOR Q_Deliv
>>>>
>>>>THIS.Grid1.RecordSource="Q_Deliv"
>>>>THIS.Grid1.Column1.ControlSource="Q_Deliv.cAction"
>>>>THIS.Grid1.Column2.ControlSource="Q_Deliv.dDueDate"
>>>>THIS.Grid1.Column3.ControlSource="Q_Deliv.dcomplete"
>>>>
>>>>THISFORM.Grid1.Refresh
>>>>
>>>>When I click on the delete button, the record is delete on the view. When I click on the refresh button the record is still there and when I look at the table the record is still there. I know this all has to do with buffering settings on the form. What am I missing?
>>>>
>>>>TIA
>>>>
>>>>/Chris
>>>Chris,
>>>Is tableupdate() commented ? Uncomment, views are buffered by default. Also include viewname there, it might not be current alias.
>>>Cetin
>>
>>I was getting a "Program error - Function requires row or table buffering" so I changed it to =TABLEUPDATE(.t.,.t.,"MyDeliverables"), it now seems to work. Any other suggestions you can pass my way?
>>
>>/Chris
>Hi Chris,
>Other suggestions ? OK how about changing the code a little bit (take backup first) ?
>You use an SQL to set grid recordsource (RO this way). OK you might do that, I would suggest directly setting Grid.recordsource to SQL so you don't need to have extra code in refresh. Here though it's important that myDeliverables view should have an index on "nOSPKey". If not do it first.
>SET MULTILOCKS ON
>
>set deleted on
>
>*form.init
>with thisform.grid1
> .ColumnCount = -1
> .RecordSourceType = 3
> .RecordSource = "SELECT cAction, dDueDate, dComlete, nDelKey "+;
> "FROM MyDeliverables "+;
> "WHERE nOSPKey=THISFORM.t_nOSPKey.VALUE "+;
> "INTO CURSOR Q_Deliv"
> .ColumnCount = 3
>endwith
>* views are buffered by default
>* but this is what I too do to be sure what type of buffering is used
>* at the moment
>= CURSORSETPROP('Buffering', 5, 'MyDeliverables')
>
>* Put a delete button: + refresh
>** FROM1.cmdDelete.Click
>
>DELETE FROM MyDeliverables WHERE nDelKey=Q_Deliv.nDelKey
>= TABLEUPDATE(2,.t.,"myDeliverables")
>THISFORM.Grid1.Refresh
OTOH you could directly use the view itself in grid.
>Cetin