Solved

create relationship from table to view

Posted on 2013-06-23
8
515 Views
Last Modified: 2013-06-25
hey guys i'm just curious. in the relationships table i can add both tables and queries to the canvass.

1) can i create a relationship from a query to a table or i can't, it's just there for me to visually see the select query?

(i tried creating a relationship from the select query to the table but the below is what it shows me)

2) i've heard about views. is a select query a view? so all my select queries in access are views right? if they're not, what's the difference between a view and a select query? thanks!

viewtotable
0
Comment
Question by:developingprogrammer
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
Yes,  you can create a relationship between a query and a table (in the query designer or SQL view).  When you try to create the relationship and double click on the line joining the two tables, it will display the table/query names at the top and the fields that are currently linked in the section above the check boxes.

A "view" is the term that SQL Server uses for saved queries, it is not usually a term associated with Access queries.
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 50 total points
Comment Utility
The difference is that when using a query, the relationsship is just informal and for display only - that why the three textboxes are greyed out.

/gustav
0
 

Author Comment

by:developingprogrammer
Comment Utility
hrmm ok let me try and develop the queries for my DB and see if i need relationships and as such would have real test cases to better understand this. but thanks for your help gustav and fyed!! let me get back to yall in awhile ya! = )
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
When you are building table relationships, it is generally to ensure some form of referential integrity (ie, you must have a matching record in one table for an entry in another table).  An example of this would be a States table and an Address table.  With a properly defined relationship, you would not be able to enter ZZ as a [StateCD] field in tblAddresses if there is not a matching [StatesCD] value in tblStates.

However, when a relationship is defined in a query, it is normally so that you can retrieve other information from a second table, based on the value in the first table.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Accepted Solution

by:
datAdrenaline earned 350 total points
Comment Utility
"Yes,  you can create a relationship between a query and a table"

You are not creating a Relationship in this scenario.  You are merely defining how you want the AutoJoin feature of the Access UI will JOIN when using both the Query object and Table object in another Query object.

Remember, a Relationship (with R/I, of course) is a constraint that governs data going into the database must adhere to.  A JOIN is how the data is presented to the user.  A "Relationship" without R/I is, again, a simply a suggested JOIN for the AutoJoin feature.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 100 total points
Comment Utility
datAdrenaline,

Your are, of course, correct about the difference between a "relationship" and "join".  I stand corrected, and should have used the word JOIN in both my earlier posts when referring to queries.

Dale
0
 

Author Closing Comment

by:developingprogrammer
Comment Utility
whao guys, thanks so much for your help and guidance and the culture here is really humbling and wonderful seeing how we all learn from each other and progress along together. thanks guys once again and yall are really wonderful!! = )
0
 
LVL 11

Expert Comment

by:datAdrenaline
Comment Utility
You're welcome!  Good luck on your project!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now