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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Record In grid

Status
Not open for further replies.

thawatwong

Instructor
Aug 25, 2002
38
HK
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
 
HI 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
 
Hi,

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.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
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?.

Thank,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top