Hi Vlad,
Thank your for your help so far, and sorry, I did not read your last message properly, you said "AfterRowColchange", I read "Before". Just goes to show that one sees what one expects to see.
But because I did not read properly, I actually got the thing to work in the BeforeRowColChange method (sort of).
If a new record is added it works, but if the user decides to empty a previously filled member and then moves away from the record, it only works in the debugger, not in real life.
Grid refresh does not have any effect any either, but KEYBOARD '{UPARROW}' does.
I'd appreciate it if you could have another look at this, even though I'm using a different approach from the one you suggested.
llEnabled=NOT EMPTY(THIS.Column1._TextBox1.VALUE) AND RECCOUNT(THIS.RECORDSOURCE)# 0
lnRecno=THIS._record
THISFORM.Navigationbar1.NewButton.ENABLED=llEnabled
THIS.PARENT.NewButton.ENABLED=llEnabled
THIS.ALLOWADDNEW=llEnabled
lnState=GETFLDSTATE("Member")
IF lnState # 1
DO CASE
CASE EMPTY(THIS.Column1._TextBox1.VALUE)
llRetval=TABLEREVERT(.F.,"ActiveMembers")
IF EOF("ActiveMembers")
KEYBOARD '{UPARROW}'
ENDIF
CASE INDEXSEEK(ALLTRIM(THIS.Column1._TextBox1.VALUE),.F.,"Members","Member")
llRetval=TABLEREVERT(.F.,"ActiveMembers")
CASE SEEK(ALLTRIM(THIS.Column1._TextBox1.VALUE),"ActiveMembers","Member");
AND RECNO("ActiveMembers") # lnRecno
GO lnRecno IN ActiveMembers
llRetval=TABLEREVERT(.F.,"ActiveMembers")
ENDCASE
ENDIF
>Hi!
>
>You can use getfldstate(-1) and check if all characters there contain "3":
>
>if chrtran(getfldstate(-1),"3","")==""
>* this record is new but contains no data
>* tablerevert it:
>...
>endif
>
>So in AfterRowColChange you check if reccount() is changed (to see if new record added), if yes - store current record pointer and go to previous record, check previous record if it is completely empty or whatever and revert changes in it, then go back to new created record.
>
>As about "empty" grid - after all changes in the record source for grid you have to use "Grid.Refresh" method call to refresh grid after such changes. This include tablerevert() as well. Let me know if this helped...
>
Peter Pirker
Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?
(Woody Allen)