Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2007, 03:16 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Filter double search results

Hi all,

So, we are making this database, where you can search in. We have made this form with four comboboxes. In each combobox a keyword can be selected. Then if we push this button we made, it searches the names of people which data contains those keywords. The button opens a form with the names of people we look for.

But, because we used an 'Or' statement, it finds the same person more than once.
So, if we for example search for:
keyword1, keyword2, keyword3, keyword4
we will find:
person1, keyword1, keyword2, keyword3, keyword4
and
person1, keyword1, keyword2, keyword3, keyword5
Because keyword5 is also an keyword in that area connected to person1, and we use the 'Or' statement the second line is an output as well.

The question now is, how to filter the output so that we get every person just once on a form? Hope the problem is clear and someone can help us.

Grtz,
AB
 
Old June 27th, 2007, 07:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. if you don't mind showing the keywords, you can try distinct like before.. if you also want to show all the keywords, then is very different.. why do you receive 2 rows with similar and different keywords?? maybe how you make that table will help us a little more...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old June 28th, 2007, 06:42 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Gonzalo,

Thank you for replying!!

We don't mind not showing the keywords, but we do not really know where to put the 'Distinct'. Before, we could easily put it after a 'Select' statement.

About the table, there are four tables wich are all connected to one table through numberId's of people. Now each person can have more than one keyword in each of the four tables. So in table4 a person1 can have keyword4 and keyword5.
Therefore a person1 can have the combination of keywords 1,2,3 and 4 and also the combination of keywords 1,2,3 and 5. And both the combinations are true with the 'Or' statement.

Hope our explanation is clear so.

Grtz,
AB
 
Old June 28th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well.. the Distinct should be before the select... I don't fully understand how you build the tables, but just show the person field in the select...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter results by value in a gridview field cesemj ASP.NET 2.0 Basics 2 February 20th, 2008 11:39 PM
Filter grid view results by range of values srinredd59 ASP.NET 2.0 Professional 0 December 27th, 2006 03:55 PM
Filter GridView Results by date range srinredd59 ASP.NET 2.0 Basics 0 December 27th, 2006 03:53 PM
How do I display search results... aspiretech9 PHP Databases 1 April 25th, 2005 12:11 PM
Double search using an input text box Karel Access VBA 2 October 25th, 2003 10:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.