0

Table Relationship?

I made a Campsite DB. One table is "Campground", another is "Restaurants". In the Campground table I want to link (show) nearby Restaurants. Problem I've encountered is once I link one restaurant to one campground then I can't use that restaurant again for another nearby campground. What type of table relationship do I need to set up for this to work?

5 replies

null
    • John_Halls
    • 7 hrs ago
    • Reported - view

    Hi  This is a many to many relationship. If you ask, can a campsite have more than one restaurant nearby and can a restaurant be close to more than one campsite and the answer is yes to both then you have a many-to-many relationship on your hands. It's a common construct and easy to implement. With campsites on one side and restaurants on the other side, a join table sits between them. It has two relationship fields, one to each of the two main tables and can hold additional information that pertains to the join, eg distance, travel time. The data is shown from the point of view of the join table for each main tables, showing the other side.

    I can put something together for you if you want to see what this looks like.

    Regards John 

      • Mr_K
      • 6 hrs ago
      • Reported - view

      Thanks. Let me try to do the work first. I'll get back to you if I need more help.

      • Mr_K
      • 6 hrs ago
      • Reported - view

       I have the many-to-many table created and I can add restaurants to campgrounds and campgrounds to restaurants in the "Restaurants Nearby" table, but I can't add an existing record when I'm in the Campground table. When I click on Add existing record I get Search in Restaurants Nearby, but I need to search in Restaurants. Can I make that work?

      • Fred
      • 4 hrs ago
      • Reported - view

       Are you trying to link a new restaurant to a campsite? There are two ways to do this:

      1) work in the Restaurants Nearby table

      2) create a data entry page where you can link campsites and restaurants.

      I have a DB that only I use, but I use a data entry page to interact with my db. Once you get one setup it will make data entry easier because you don't need to jump around tables to do things. It is all done in one page.

      • Mr_K
      • 2 hrs ago
      • Reported - view

      Thanks. I'll check out a data entry page.

Content aside

  • 2 hrs agoLast active
  • 5Replies
  • 13Views
  • 3 Following