Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Multiple Flags

Discussion in 'Information Technology' started by Shoelaces, Jul 28, 2006.

Tags:
  1. Shoelaces

    Shoelaces
    Expand Collapse
    Guest

    I am looking for how to design a db that will allow me to have multiple flags
    for an event.

    I use Mastercook, which is a recipe database. When one enters a recipe, he
    can flag whether the recipe is chicken, pork, beef, breakfast, lunch, dinner,
    etc. There is no limit to how many flags he can associate with a recipe, so
    if the dish has both chicken and pork, one would check both of those boxes.

    I am working on a project that I would like to add a similar function. For
    each event, I would like the user to be able to flag all state standards that
    may apply to it. My question is how do I set this up?

    Do I need a unique field for each one and checking the standard will turn it
    on? If so, what if there are 100+ standards that could be applied?

    In the end, I would like to be able to search based on the standards and
    returned all events that have been flagged with whatever I am searching for.
    I figure I must be missing how to do this without building a unique field for
    each.

    I would appreciate any help with this.

    Thannks.
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Create a table that has a *record* (not a field) for each of the possible
    options.

    Now create a 2nd table that allows you to link the other 2. If your existing
    tables are:
    - Recipe table, with a RecipeID primary key;
    - Category table, with a CategoryID primary key;
    then the 3rd table will have fields like this:
    RecipeID relates to Recipe.RecipeID
    CategoryID relates to Category.CategoryID

    Now one recipe can belong to as many categories as you desire. Your Recipe
    form will have a subform bound to the RecipeCategory table. The CategoryID
    field will be a combo where you can choose as one category on each row of
    the subform.

    This is the standard way to solve the many-to-many relation (one recipe can
    belong to many categories, and one category can contains many recipies.) The
    3rd table is called a junction table.

    Once you get that working, you will want to filter the main form to only
    recipies of one category. For details on how to do that, see:
    Filter a Form on a Field in a Subform
    at:
    http://allenbrowne.com/ser-28.html

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Shoelaces" <Shoelaces@discussions.microsoft.com> wrote in message
    news:BAFC152A-95FC-4CED-860A-C03A9E61883D@microsoft.com...
    >I am looking for how to design a db that will allow me to have multiple
    >flags
    > for an event.
    >
    > I use Mastercook, which is a recipe database. When one enters a recipe,
    > he
    > can flag whether the recipe is chicken, pork, beef, breakfast, lunch,
    > dinner,
    > etc. There is no limit to how many flags he can associate with a recipe,
    > so
    > if the dish has both chicken and pork, one would check both of those
    > boxes.
    >
    > I am working on a project that I would like to add a similar function.
    > For
    > each event, I would like the user to be able to flag all state standards
    > that
    > may apply to it. My question is how do I set this up?
    >
    > Do I need a unique field for each one and checking the standard will turn
    > it
    > on? If so, what if there are 100+ standards that could be applied?
    >
    > In the end, I would like to be able to search based on the standards and
    > returned all events that have been flagged with whatever I am searching
    > for.
    > I figure I must be missing how to do this without building a unique field
    > for
    > each.
    >
    > I would appreciate any help with this.
    >
    > Thannks.
     
  4. Shoelaces

    Shoelaces
    Expand Collapse
    Guest

    "Allen Browne" wrote:
    > Create a table that has a *record* (not a field) for each of the possible
    > options.


    > Now one recipe can belong to as many categories as you desire. Your Recipe
    > form will have a subform bound to the RecipeCategory table. The CategoryID
    > field will be a combo where you can choose as one category on each row of
    > the subform.


    Thank you for your assistance.

    It looks like I had the structure set up correctly.

    Now, I need to figure out sub-forms. That at least opens where I need to
    look.

    Thank you.
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page