PC Review


Reply
Thread Tools Rate Thread

Add rows to MSysRelationships via VBA/DAO?

 
 
NKTower
Guest
Posts: n/a
 
      4th Jul 2009
I have inherited an ACC2003 (.mdb)/SQL Server 2005 application and so far I
have identified 83 parent_tablename.primary_key/child_tablename.foreign_key
pairs for which I would like to pre-define the Join Property
(Left/Right/Inner) programmatically so that when the user drags/drops tables
into query design grid the preferred relationship and join type is there.
(Right now there are many automatic links of ID to ID where chilld record's
pk isn't ID - yech! - I'm working on that as I find them.

Google search found some “you can do it with DAO” responses but no
details/examples. Some links pointed to MS KBs but they only showed how to
use the GUI Relationships window. I’d rather not have to do all of that
clicking if I can whip up something to use my tables. Anybody know how?

If it is just simple
RS_MSysRel.AddNew and
RS_MSysRel("column") = value and
RS_MSysRel.Update etc.
then great, but what are those numeric values and what's the other stuff
like "UW" etc. Worst case is reverse engineer, but hope I don't have to.

Thanks for looking.
 
Reply With Quote
 
 
 
 
NKTower
Guest
Posts: n/a
 
      4th Jul 2009

Oops - typo - make that "child tables FOREIGN key isn't ID - but you probably
figured that out anyway.

"NKTower" wrote:

> I have inherited an ACC2003 (.mdb)/SQL Server 2005 application and so far I
> have identified 83 parent_tablename.primary_key/child_tablename.foreign_key
> pairs for which I would like to pre-define the Join Property
> (Left/Right/Inner) programmatically so that when the user drags/drops tables
> into query design grid the preferred relationship and join type is there.
> (Right now there are many automatic links of ID to ID where chilld record's
> pk isn't ID - yech! - I'm working on that as I find them.
>
> Google search found some “you can do it with DAO” responses but no
> details/examples. Some links pointed to MS KBs but they only showed how to
> use the GUI Relationships window. I’d rather not have to do all of that
> clicking if I can whip up something to use my tables. Anybody know how?
>
> If it is just simple
> RS_MSysRel.AddNew and
> RS_MSysRel("column") = value and
> RS_MSysRel.Update etc.
> then great, but what are those numeric values and what's the other stuff
> like "UW" etc. Worst case is reverse engineer, but hope I don't have to.
>
> Thanks for looking.

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      4th Jul 2009

I would strongly advise against updating system tables directly.

Use the CreateRelation method, or work with Properties of the Relation
object.

http://msdn.microsoft.com/en-us/library/bb221012.aspx

http://msdn.microsoft.com/en-us/library/bb177503.aspx

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"NKTower" <(E-Mail Removed)> wrote in message
news:AF68FB18-618D-46BD-9B5C-(E-Mail Removed)...
>I have inherited an ACC2003 (.mdb)/SQL Server 2005 application and so far I
> have identified 83
> parent_tablename.primary_key/child_tablename.foreign_key
> pairs for which I would like to pre-define the Join Property
> (Left/Right/Inner) programmatically so that when the user drags/drops
> tables
> into query design grid the preferred relationship and join type is there.
> (Right now there are many automatic links of ID to ID where chilld
> record's
> pk isn't ID - yech! - I'm working on that as I find them.
>
> Google search found some "you can do it with DAO" responses but no
> details/examples. Some links pointed to MS KBs but they only showed how
> to
> use the GUI Relationships window. I'd rather not have to do all of that
> clicking if I can whip up something to use my tables. Anybody know how?
>
> If it is just simple
> RS_MSysRel.AddNew and
> RS_MSysRel("column") = value and
> RS_MSysRel.Update etc.
> then great, but what are those numeric values and what's the other stuff
> like "UW" etc. Worst case is reverse engineer, but hope I don't have to.
>
> Thanks for looking.



 
Reply With Quote
 
NKTower
Guest
Posts: n/a
 
      4th Jul 2009

Excellent! Thank you.

"Douglas J. Steele" wrote:

> I would strongly advise against updating system tables directly.
>
> Use the CreateRelation method, or work with Properties of the Relation
> object.
>
> http://msdn.microsoft.com/en-us/library/bb221012.aspx
>
> http://msdn.microsoft.com/en-us/library/bb177503.aspx
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>

 
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
MSysRelationships Loterken Microsoft Access 5 20th May 2010 08:20 AM
MSysRelationships problem -access 2003 ליאון ג''''ירד Microsoft Access Forms 0 18th Apr 2009 12:26 AM
Re: Alter MSysRelationships Tony Toews Microsoft Access 2 20th Sep 2005 05:54 AM
duplicate 'MSysRelationships' table bamboow b via AccessMonster.com Microsoft Access Form Coding 1 13th Jul 2005 02:26 PM
Editing mSysRelationships =?Utf-8?B?SmltIFRhbmlz?= Microsoft Access Database Table Design 1 26th Mar 2005 01:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.