Board index » delphi » Preventing duplicates - the right way?
Wed, 14 May 2003 03:00:00 GMT
Preventing duplicates - the right way?
Using Delphi 5, dBaseIV tables and a DBGrid. In an effort to prevent
duplicate records in a simple table, I am using the following code. It
appears to work as intended, but I am wondering if this is the "right" way
to do it. Table1 is the main table that will actually accept the changes
from the grid. Table2 is really the same table but not connected to any
components and is used solely for lookup purposes.
procedure TForm1.Table1BeforePost(DataSet: TDataSet);
if Table2.Locate ('TYPE',dbgrid1.SelectedField.AsString,)=true then
Any comments or suggestions would be very welcome.