PC Review


Reply
Thread Tools Rate Thread

Defining: Join props in Design Query view vs Relationships

 
 
=?Utf-8?B?UmljaGFyZEE=?=
Guest
Posts: n/a
 
      15th Jun 2004
Hello,
What is the difference/advantages either way between defining join properties "on the fly" in the Design Query View vs. permanent definition under the Tool-Relationships menu procedure?

It seems that I can define them on the fly using the following code without any setting of primary keys (equivalent to doing so in the Design query view), while setting of primary keys is necessary for permanent definition under the Tool-Relationships menu procedure. Is there any danger in not setting the primary keys but just doing the join and make table (later export table) on the fly? If there is no danger, why ever bother with the Tools-Relationships menu procedure?

Dim strSQL As String
strSQL = "SELECT zmax2.*, rooting2.* " & _
"INTO temp " & _
"FROM zmax2 LEFT OUTER JOIN rooting2 " & _
"ON zmax2.musym = rooting2.musym"

'Turn off warning message.
DoCmd.SetWarnings False

DoCmd.RunSQL strSQL

'Re-enable warning message
DoCmd.SetWarnings True


RichardA
 
Reply With Quote
 
 
 
 
Ted Allen
Guest
Posts: n/a
 
      15th Jun 2004
Hi Richard,

These are actually two fundamentally different things.
The relationships window allows you to set relationships
for the purpose of preserving data integrity. By doing
so, you can instruct Access to do certain things such as
not accepting a foreign key value that does not exist in
the primary table, deleting records from detail tables
when the corresponding record in the master table is
deleted, etc.

In queries, you also define relationships between tables,
but only for the purposes of defining the output that the
query will provide. True, that by default the query
builder imports the relationships that you have set in
the relationships window (actually this may be an option,
I can't remember offhand), but these can be changed
according to the needs for each individual query. The
relationships defined in queries have no impact on how
Access treats the relationships between tables regarding
data integrity, as those continue to follow the
relationships saved in the relationships window.

Hope that helps.

-Ted Allen
>-----Original Message-----
>Hello,
>What is the difference/advantages either way between

defining join properties "on the fly" in the Design Query
View vs. permanent definition under the Tool-
Relationships menu procedure?
>
>It seems that I can define them on the fly using the

following code without any setting of primary keys
(equivalent to doing so in the Design query view), while
setting of primary keys is necessary for permanent
definition under the Tool-Relationships menu procedure.
Is there any danger in not setting the primary keys but
just doing the join and make table (later export table)
on the fly? If there is no danger, why ever bother with
the Tools-Relationships menu procedure?
>
> Dim strSQL As String
> strSQL = "SELECT zmax2.*, rooting2.* " & _
> "INTO temp " & _
> "FROM zmax2 LEFT OUTER JOIN rooting2 " & _
> "ON zmax2.musym = rooting2.musym"
>
> 'Turn off warning message.
> DoCmd.SetWarnings False
>
> DoCmd.RunSQL strSQL
>
> 'Re-enable warning message
> DoCmd.SetWarnings True
>
>
>RichardA
>.
>

 
Reply With Quote
 
=?Utf-8?B?UmljaGFyZEE=?=
Guest
Posts: n/a
 
      15th Jun 2004
Ted,

I think this was very helpful. thanks.

RichardA

"Ted Allen" wrote:

> Hi Richard,
>
> These are actually two fundamentally different things.
> The relationships window allows you to set relationships
> for the purpose of preserving data integrity. By doing
> so, you can instruct Access to do certain things such as
> not accepting a foreign key value that does not exist in
> the primary table, deleting records from detail tables
> when the corresponding record in the master table is
> deleted, etc.
>
> In queries, you also define relationships between tables,
> but only for the purposes of defining the output that the
> query will provide. True, that by default the query
> builder imports the relationships that you have set in
> the relationships window (actually this may be an option,
> I can't remember offhand), but these can be changed
> according to the needs for each individual query. The
> relationships defined in queries have no impact on how
> Access treats the relationships between tables regarding
> data integrity, as those continue to follow the
> relationships saved in the relationships window.
>
> Hope that helps.
>
> -Ted Allen
> >-----Original Message-----
> >Hello,
> >What is the difference/advantages either way between

> defining join properties "on the fly" in the Design Query
> View vs. permanent definition under the Tool-
> Relationships menu procedure?
> >
> >It seems that I can define them on the fly using the

> following code without any setting of primary keys
> (equivalent to doing so in the Design query view), while
> setting of primary keys is necessary for permanent
> definition under the Tool-Relationships menu procedure.
> Is there any danger in not setting the primary keys but
> just doing the join and make table (later export table)
> on the fly? If there is no danger, why ever bother with
> the Tools-Relationships menu procedure?
> >
> > Dim strSQL As String
> > strSQL = "SELECT zmax2.*, rooting2.* " & _
> > "INTO temp " & _
> > "FROM zmax2 LEFT OUTER JOIN rooting2 " & _
> > "ON zmax2.musym = rooting2.musym"
> >
> > 'Turn off warning message.
> > DoCmd.SetWarnings False
> >
> > DoCmd.RunSQL strSQL
> >
> > 'Re-enable warning message
> > DoCmd.SetWarnings True
> >
> >
> >RichardA
> >.
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Deleting a join in Query design view? Jerry Whittle Microsoft Access Queries 0 2nd Apr 2008 09:12 PM
Table design and relationships to support calculation in query Mara Microsoft Access Database Table Design 5 27th Mar 2008 08:06 AM
Can't represent join in design view... Bongard Microsoft Access Queries 1 3rd Aug 2007 08:28 PM
Join deleted in Design view =?Utf-8?B?RW5uZXg=?= Microsoft Access Queries 1 5th Mar 2005 05:28 PM
In a query "can't represent join expression in design view" =?Utf-8?B?Q2hhcmxpZQ==?= Microsoft Access 1 22nd Dec 2004 08:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:03 PM.