Mar 15 2005, 10:49 AM
I have a form that I wish to have toggle buttons at the top.
The toggle buttons will filter my list of contacts and provide customers, competitors or suppliers based on a single list of contacts. There is are separate yes/no fields for whether a contact is a customer, competitor or supplier. This allows a contact to potentially be any combination of the three.
With my form open, showing all contacts I have a toggle button group but am unsure how to make each button filter.
I've started in the After Update for the group and used - Select ContactGroup....Case 1.....End select.
Does anyone know what code I should use to do these single field filters? Or has anyone ever tried anything similar that I could get an idea from?
Mar 15 2005, 11:00 AM
I've used variations of this filtering code many times. Great stuff! Fortunately I included references to the source in my code, so I could find it quickly for you. http://home.clara.net/tkwickenden/coding.htm
Look down the page for
acCmdFilterByForm Filter Records Using The Filter By Form Method
acCmdFilterBySelection Filter By Selection
acCmdFilterExcludingSelection Filter Excluding Selection
Mar 15 2005, 11:08 AM
If you have 3 check boxes in each record for Customer, Competitor or Supplier then you have repeating groups and you need to restructure your data. These three items should be separate records in a related table. IF, on the other hand, a record can ONLY be a Customer, Competitor or Supplier and NEVER two of those choices then you should have a foreign key field that stores the Primary key for a table where the records are Customer, Competitor or Supplier.
If you normalize your structure it will be very easy to filter your data by selecting the type (Customer, Competitior, Supplier) from a list or combo box...
Just my 3 cents worth...
Mar 15 2005, 12:26 PM
Thanks Jack, it did occur to me that I should do as you suggested and split the "contact types" off but the way I want to display this information (going across the page rather than down it) and since a contact will only ever be one or some of these choices I decided to lump them all in the same table. Not entirely correct but simplest at this stage.
Thanks NorthNone - I'm looking at that website now!
Mar 15 2005, 03:47 PM
Since you are aware that your data is not normalized then go for the gusto!
Mar 16 2005, 07:44 AM
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here