Question on Filtering??

Castaway

Registered User.
Local time
Today, 19:23
Joined
Feb 26, 2001
Messages
17
Hi

I have this database that list companies and what type of loan they have. I am having a hard time thinking of the right type of filter to use. I am looking to select multiply types of loans and have it filter out the companies that have that service. I was thinking of a list box or options but I am having trouble with the table. My question is how would you go about it? Thanks
 

Attachments

Just a minute on this one. You're two tables in and it's already not normalized. Let me play with this for a few and I'll show you how to do this.

EDIT: Okay, I've normalized it and showed you how to do what you're after. Note that I didn't remove any of your existing stuff. Instead, I recreated it so you could compare/contrast so that you get what I did.

First, I made three new tables: t_LoanTypes, t_Lenders, and t_Loans.

t_LoanTypes contains each type of loan and assigns it an ID.

t_Lenders contains each lender and assigns each lender an ID.

t_Loans contains three fields: LoanID, LenderID, and LoanTypeID. This is your "main table" as it were as it stores each loan and assigns the LoanID to exactly one lender and one loan type, both through IDs.

Next I made three new queries: q_ViewLoans, q_FilterLoans-Include, and q_FilterLoans-Exclude.

q_ViewLoans is an unfiltered look at all the loans you have. This is the view of the table that you will manipulate/filter to show specific data. The other two queries are offshoots of this one.

q_FilterLoans-Include shows you how to view only loans that have a specific LoanTypeID (or IDs). This is the "Show me the loans that equal these types of loan(s)" view.

q_FilterLoans-Exclude shows you how to view only loans that do not have a specific LoanTypeID (or IDs). This is the "Show me the loans that are not these types of loan(s)" view.

It should be clear what I've done here. Normalize it first, and then the filtering becomes very easy. Filter on IDs, not names. And never store multiples of the same word(s) over and over again. Assign them to an ID and look them up as necessary.

HTH
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom