PC Review


Reply
Thread Tools Rate Thread

Re: Relationship not showing up in relationship view

 
 
Allen Browne
Guest
Posts: n/a
 
      10th Aug 2004
Tom, it sounds like Access is enforing a relation that you cannot see, and
it does not even show up when you "Show All".

You can programmatically list the relations using the code below, and you
can also use the Delete method of the Relations collection to get rid of a
hidden relation once you know its name. If you are comfortable with code,
that might be the way to go.

Function ShowRel()
'Purpose: List the relations to the Immediate Window.
Dim db As DAO.Database
Dim rel As DAO.Relation

Set db = DBEngine(0)(0)
For Each rel In db.Relations
Debug.Print rel.Name, rel.Table, rel.ForeignTable
Next

Set rel = Nothing
Set db = Nothing
End Function

If you are still stuck, the code in this link deletes ALL the relationship
in your database. After compacting, you can then rebuild the ones you want:
http://members.iinet.net.au/~allenbrowne/DelRel.html

The most likely cause for the problem is Name Autocorrect. Uncheck the boxes
under Tools | Options | General | Name AutoCorrect, and then compact the
database so the problem does not recur. More information about these
problems:
http://members.iinet.net.au/~allenbrowne/bug-03.html

As a last resort, you can always get Access to rebuild your database by
creating a new one (File | New) and importing everything from the problem
one (File | Get External | Import). In that dialog there is an Options
button, which allows you to NOT import the relations.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom" <(E-Mail Removed)> wrote in message
news:B1186956-5F97-48B9-9764-(E-Mail Removed)...
>
> I am using Access 2000, and had a relationship setup to link 2 tables
> together. I later decided to change the design and delete the link. The
> link
> is not showing up in "Relationhips" view, and when I try to add a record
> it
> says I can't because the record doesn't exist in the related table. It
> says
> to break the link before I can change, but I can't because it doesn't show
> up. HELP
>
> Thanks,
>
> Tom
> --
> When eveythings coming at you at once, you're in the wrong lane.



 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      10th Aug 2004
To use the code:
1. Select the Modules tab of the Database Window.

2. Click New. Access opens a code window.

3. Paste the function into this code window.

4. If Access 2000 or 2002, choose References from the Tools menu, and check
the box beside:
Microsoft DAO 3.6 Library.

5. Choose Compile from the Debug menu. (This checks Access can make sense of
the code.)

6. Press Ctrl+G to open the Immediate Window. Enter:
? ShowRel()

Once you know the name of the relation you want to delete, you can enter
this directly into the Immediate Window:
dbEngine(0)(0).Relations.Delete "xxxxx"
where "xxxxx" represents the name of the relation you want to get rid of.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom" <(E-Mail Removed)> wrote in message
news:B747B01D-CE0E-4527-BC5A-(E-Mail Removed)...
> Hi Allen,
>
> How do I run this code? Do I create a .vbs file with it? And
> after, how do I delete these relationships once I see them. Is there an
> option for that?
>
> Thanks,
>
> Tom
>
> "Allen Browne" wrote:
>
>> Tom, it sounds like Access is enforing a relation that you cannot see,
>> and
>> it does not even show up when you "Show All".
>>
>> You can programmatically list the relations using the code below, and you
>> can also use the Delete method of the Relations collection to get rid of
>> a
>> hidden relation once you know its name. If you are comfortable with code,
>> that might be the way to go.
>>
>> Function ShowRel()
>> 'Purpose: List the relations to the Immediate Window.
>> Dim db As DAO.Database
>> Dim rel As DAO.Relation
>>
>> Set db = DBEngine(0)(0)
>> For Each rel In db.Relations
>> Debug.Print rel.Name, rel.Table, rel.ForeignTable
>> Next
>>
>> Set rel = Nothing
>> Set db = Nothing
>> End Function
>>
>> If you are still stuck, the code in this link deletes ALL the
>> relationship
>> in your database. After compacting, you can then rebuild the ones you
>> want:
>> http://members.iinet.net.au/~allenbrowne/DelRel.html
>>
>> The most likely cause for the problem is Name Autocorrect. Uncheck the
>> boxes
>> under Tools | Options | General | Name AutoCorrect, and then compact the
>> database so the problem does not recur. More information about these
>> problems:
>> http://members.iinet.net.au/~allenbrowne/bug-03.html
>>
>> As a last resort, you can always get Access to rebuild your database by
>> creating a new one (File | New) and importing everything from the problem
>> one (File | Get External | Import). In that dialog there is an Options
>> button, which allows you to NOT import the relations.
>>
>>
>> "Tom" <(E-Mail Removed)> wrote in message
>> news:B1186956-5F97-48B9-9764-(E-Mail Removed)...
>> >
>> > I am using Access 2000, and had a relationship setup to link 2 tables
>> > together. I later decided to change the design and delete the link. The
>> > link
>> > is not showing up in "Relationhips" view, and when I try to add a
>> > record
>> > it
>> > says I can't because the record doesn't exist in the related table. It
>> > says
>> > to break the link before I can change, but I can't because it doesn't
>> > show
>> > up. HELP
>> >
>> > Thanks,
>> >
>> > Tom
>> > --
>> > When eveythings coming at you at once, you're in the wrong lane.



 
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
Hard Drive view not showing "all items" but view associated with m =?Utf-8?B?bWVj?= Windows Vista File Management 0 7th Sep 2006 09:05 AM
table relationship in query & relationship mode =?Utf-8?B?UmxhdGlvbnNoaXA=?= Microsoft Access 1 3rd Oct 2005 04:07 PM
Relationship not in relationship window - I can't update table =?Utf-8?B?QU1MUg==?= Microsoft Access Database Table Design 3 28th Apr 2005 01:03 PM
Relationship not showing up in relationship view Bob Microsoft Access Database Table Design 1 10th Aug 2004 12:47 PM
Re: Relationship not showing up in relationship view tina Microsoft Access Database Table Design 2 10th Aug 2004 04:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 PM.