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

Suppressing Duplicate Records 2

Status
Not open for further replies.

NavyFederalDetta

Technical User
Mar 22, 2006
16
I need to know the command to suppress an entire record if it a key field is duplicated.

Example, if the employee number is duplicate I only want to see the first record on that employee.


can someone help??

Thanks!
 
Go to the Database menu and turn on "Select Distinct Records" is the easiest way, but it only works if ALL of the data selected is the same between records.

Another way to do this is to use the group headers and footers instead of the detail data. To do this you would have to have a group on the employee - I would recommend grouping on lastname + ', ' + firstname (grouping on employee id would put the info in an odd order). You then put your data in the group header instead of the details and your data should appear only once.

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Another option would just be to use a formula to suppress the duplicate detail line. This would be done by adding the formula via the section expert. It would be similar to the following:

WhilePrintingRecords;

if previous({table.record_ID}) = {table.record_ID} then true
 
And actually, if you're dealing with an expression that already evaluates to true or false, you don't need to use If..Then true in your formula. For example, Ridyen's formula would look like this:

WhilePrintingRecords;

previous({table.record_ID}) = {table.record_ID}

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thank you both! I was thinking there was a formula but I just didn't know the syntax. This has been incredibly helpful for this and other reports I have written.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top