I using GRID as data entry form.When I input data to grid,I can,t check duplicate record.Could anybody have a good suggestion?.Thank you for all advance.
Thawatwong
myGrid.myKelFieldColumn.Text1.ValidEvent
****************************************
LOCAL lnRec, lcALias
lcALias = ALIAS()
lnRec = RECNO(This.RecordSource)
SELECT (This.RecordSource)
SCAN
** Check for your record duplcate status.
** If duplicate.. do what ever you want
** Return .f.
ENDSCAN
GO lnRec
SELECT (lcAlias)
Note you dont allow any other column to be accepted, without a key field getting a value. This you can do.. by putting the code suitably in the When event of each other columns Text1.When event..
WHEN Event
RETURN !EMPTY(myKeyField)
Hope this helps you
ramani
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Thank you very much Ramani,but my RecordSource is a view.
It updated afterI input all of record in grid(may be 2-5 record)
I want to check input data in a grid at that time for duplicate,I mean to prevent userinput the same data in grid.
Thank
In your save button's click event, you have to put similar code for checking the duplicates.
1. You can decide to extract all the duplicates and ask for confirmation of users to delete or update..
2. Or... You can leave the duplicates ..
3. Or... YOu can overwrite the earlier one with the current input..
4. And you can even provide the choice to user to choose one of this.
But how to code is left to you.. The concept is as above with code similar to my earlier posting.
Hi,Ramani
Thank again for your kind,but I mean I want to check the duplicate data input on grid(not in a view or a table),such as
input ID3145 in row 1 col 1,then if input this value in any row
(col 1) again,it should have error message.This rule occure before update table,so how can I scan data on grid?.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.