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

Search Query Duplicate Record PROBLEM!!!

Status
Not open for further replies.

cooldisk2005

Technical User
Aug 3, 2005
119
US
All,
I am having problems with this query on a certain part:
The code is behind a command button on a search form.

Everything works well except for the following code on page 7:

If Not IsNull(Me.sortFile) And Me.sortFile<> 0 Then
strOrder = strOrder & "tbl_Products.name asc, "
strSQL = strSQL & ", tbl_Products "
strWhere = strWhere & " tbl_PAF.MainID = tbl_Products.MainID AND"
End If

On the search form there is a radio button for the above.

tbl_Products.name is a subform field that can have a lot of data for that field.

If I choose the radio button on the search form along with some other search criteria on the form, the results come back with duplicate records. The amount of duplicate records always equals the amount of subform data is in the tbl_Products.name field. For instance if there are 5 records in this field, the results would yield 5 duplicate records.

How can I fix this problem?

Any help would be DEFINITELY appreciated.

Thanks,
 
Have you tried SELECT DISTINCTROW ?
Anyway, why sorting by a field you don't select ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
No I haven't tried SELECT DISTINCTROW. I am kind of new to this, so how would I do it?

I am not following you when you say "why sorting by a field you don't select", because I do select that field to sort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top