By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,154 Members | 2,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,154 IT Pros & Developers. It's quick & easy.

How to check related foreign keys

P: n/a
Hello,

This is my first post, i couldn't find an answer to my problem over
the other posts.

first - I have a Main table called [tblFile], this table has a primary
key that is an autonumber.
second - I have a LOT of tables that uses tblFile.ID as a foreign key.

thrid : I'm trying to see if i can do a query or a function (in VBA)
that could let me know Which other tables uses tblFile.ID in at least
1 row.
problem : there's too much related table to hardcode this function

example : the table tblProperies uses tblFile.ID as a foreign key and
the table tblProgram Also uses it as a foreign key. Actually there's
3 rows in property that uses a specified ID from tblFile and no rows
from tblProgram uses it.

So actually I want my query/function to return : "tblProperties" only.

Actually i don't know anything about this concern so please somebody
give me a hand!
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Can I ask what scenario would require this? Creating relationships between
all the tables would handle
most of the reasons I can think of.

Mike Storr
www.veraccess.com
"StaZ" <St*****@hotmail.com> wrote in message
news:d8************************@posting.google.com ...
Hello,

This is my first post, i couldn't find an answer to my problem over
the other posts.

first - I have a Main table called [tblFile], this table has a primary
key that is an autonumber.
second - I have a LOT of tables that uses tblFile.ID as a foreign key.

thrid : I'm trying to see if i can do a query or a function (in VBA)
that could let me know Which other tables uses tblFile.ID in at least
1 row.
problem : there's too much related table to hardcode this function

example : the table tblProperies uses tblFile.ID as a foreign key and
the table tblProgram Also uses it as a foreign key. Actually there's
3 rows in property that uses a specified ID from tblFile and no rows
from tblProgram uses it.

So actually I want my query/function to return : "tblProperties" only.

Actually i don't know anything about this concern so please somebody
give me a hand!

Nov 12 '05 #2

P: n/a
StaZ wrote:
Hello,

This is my first post, i couldn't find an answer to my problem over
the other posts.

first - I have a Main table called [tblFile], this table has a primary
key that is an autonumber.
second - I have a LOT of tables that uses tblFile.ID as a foreign key.

thrid : I'm trying to see if i can do a query or a function (in VBA)
that could let me know Which other tables uses tblFile.ID in at least
1 row.
problem : there's too much related table to hardcode this function

example : the table tblProperies uses tblFile.ID as a foreign key and
the table tblProgram Also uses it as a foreign key. Actually there's
3 rows in property that uses a specified ID from tblFile and no rows
from tblProgram uses it.

So actually I want my query/function to return : "tblProperties" only.

Actually i don't know anything about this concern so please somebody
give me a hand!


You can get NavQueries from my site. See under Tools.

It is a nice little tool form that shows information about the structure
of your queries, you can find/filter to see only queries containing
'tblFile.ID' for instance.

You can query the MSysQueries table yourself; I believe the column
expressions have attribute=6. A quick test results in this statement:

SELECT MSysObjects.Name, MSysQueries.Expression
FROM MSysQueries INNER JOIN MSysObjects ON MSysQueries.ObjectId =
MSysObjects.Id
WHERE (((MSysQueries.Attribute)=6) AND ((MSysQueries.Expression) Like
"*ID*"));

Have Fun.
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.