Results 1 to 7 of 7
  1. #1
    Matt.Hagle is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4

    Query isn't working!


    So I am taking a course in MS Access and need to find out what is wrong with my DB and why my query isn't working. It's very simple i'm sure, but I really don't know what to even look at to try and troubleshoot why the query shows me nothing. Can anyone give me a hint/direction/something?! I hope I attached the DB correctly. Hagle_Casestudy.accdb

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    There isn't a query in that db. What are you trying to accomplish?

    First, determine how your data is related.

    I will presume each hospital can have many doctors. Now can each doctor associate with multiple hospitals?

    If the answer is yes then this is a many-to-many relationship. This requires a third 'junction' table where each record will define a doctor/hospital pair.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Matt.Hagle is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Yeah I just deleted the query because it wasn't working. But your assumption is correct. Each doctor can be associated with multiple hospitals. And vice versa...but a doctor can only have one specialty. When I try to create the relationship between the two tables it works, but when I try to make a simple query that gets just 3 items, DoctorID, Specialty, and HosID, it gives me nothing.
    When you say a Junction table, you're saying create a third table? But with what information and how do you determine that information? I am assuming that either the "normalization" or "functional dependency" processes take place here, I just don't get where. Any hints about this will be really appreciated.

  4. #4
    Matt.Hagle is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Also, the tables have to be 3NF. Forgot to mention that. If you can see that it is or isn't if you can just say no or yes to that. I'll try to figure out the rest. I'm not looking for "the answer". Honestly because I really do want to learn this. I just need to understand what i'm looking at. Thanks much!!

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    watch a tutorial on junction tables mate. you only ever want a one to many relationship. One doctor to many hospitals, one hospital has many doctors. This is many to many.

    a junction table will define their relationship between one doctor and one hospital. each hospital and each doctor can appear on this table many times but its a one to many relationship.

    Have a look and if you have questions let us know.

  6. #6
    Matt.Hagle is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Junction tables....gotcha. I'll try it out and post back. Thanks for the suggestions.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Third 'junction' table where each record will define a doctor/hospital pair would be like:

    tblHospDocs
    ID HospID DocID IsActive
    1 5 3 True
    2 4 3 True
    3 1 7 False
    4 5 8 True

    Now build a query that uses all 3 tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Working query stops working after importing
    By Abacus1234 in forum Import/Export Data
    Replies: 3
    Last Post: 10-25-2015, 09:12 PM
  2. Query Not working
    By keiath in forum Queries
    Replies: 3
    Last Post: 02-28-2014, 10:05 AM
  3. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  4. Help please! iif not working in query!
    By ham355 in forum Queries
    Replies: 4
    Last Post: 02-16-2012, 05:05 AM
  5. Query is not working
    By pushpm in forum Programming
    Replies: 3
    Last Post: 04-14-2009, 07:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums