Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to save current line in a grid

Status
Not open for further replies.

tsh73

Programmer
Apr 27, 2002
304
RU
Hello everibody.
Excuse me - I'm sure there should be easy way to do it, but I just cannot figure out (or recall if I seen that before).
Problem:
I have a editable grid upon a table.
Then I close grid, changes I made in current line are lost.
(it seems that they saved only then I change current line).
How am I to make current line in a grid save?
(I am using FoxPro 5.0 but it probably works same way - so please share).

Thanks in advance, Tsh73.
 
If the table to which the grid is bound is not buffered, then the edits should be saved automatically when you move off the row. If the table is buffered, you need to call TABLUPDATE() to commit the changes.

Does that help at all?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thank you MikeLewis,
it make me think differently so it helps.
Apparently there are more then I just said... More than I thought then I type my question.
Here's what's going on:
I have a form named frmTermsR with a grid and Save button.
On Form Load I create cursor (from table to be modified and several lookup tables), named cTempTermsR
Then I do
Code:
USE (DBF("cTempTermsR")) IN 0 SHARED AGAIN ALIAS cTempTermsRDBF
, so I have updatable cursor cTempTermsRDBF.
Grid record source set to cTempTermsRDBF design - time.
On Save button I scan through cTempTermsRDBF, compare data with initial table and update initial table then necessary.
Then it does "relese thisform".

Now, if I changed a line and did not switched to other row, and click my "Save" button - it does work. Table updates, form closes.
BUT (here goes my problem)
then I open this form second time (DO FORM frmTermsR),
suddenly last changed row (current row) stops saving.

Now, I kind of fixed that - just in the beginning of button click procedure inserted
Code:
if ThisForm.ActiveControl.name = "Grid1"
	keyb '{DNARROW}'
endif
Just in the lines of
then the edits should be saved automatically when you move off the row
It does work now - but I afraid it shouldn't.
I just don't get what going on here.
Aren't active control on click supposed to be Button itself??
 
OK, that rules out what I was thinking. Toolbar buttons never get focus, so the current oontrol doesn't lose focus and controls don't write to the data source until they lose focus. This is a well-known behavior, but it doesn't sound like you're in this particular boat.

It sounds for all the world like you have row-level buffering turned on
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top