473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Not the right Constraint_Name = szRelationship in Access

Hi all,

Following some help from www.aspfaq.com, I have used this sql command
to find the constraint name of my foreign key:

SELECT
FK_Table = szReferencedObject,
FK_Column = szReferencedColumn,
PK_Table = szObject,
PK_Column = szColumn,
Constraint_Name = szRelationship
FROM
MSysRelationships

Unfortunately, constraint_name = szrelationship does not work; in this
sense: it does not return the displayed column value of my foreign key.
For example, if I have AuthorID (=5) as foreign key and Authors as
Foreign table, I expect that "szRelationship" returned AuthorName
(="Hemingway") but it return something like "reference1" and I don't
know what to do with it.

If there any way of getting the displayed column value of a foreign key
also using ADOX.catalog object or Openschema?
My database is Ms Access of course.

Many thanks,
Irena

Nov 13 '05 #1
2 1508
On 4 Dec 2004 09:44:13 -0800, "Irena" <ne******@hotmail.com> wrote:

I'm not sure I follow you completely. What's wrong with a Select query
like this:
Select AuthorName from Authors where AuthorID=5

-Tom.

Hi all,

Following some help from www.aspfaq.com, I have used this sql command
to find the constraint name of my foreign key:

SELECT
FK_Table = szReferencedObject,
FK_Column = szReferencedColumn,
PK_Table = szObject,
PK_Column = szColumn,
Constraint_Name = szRelationship
FROM
MSysRelationships

Unfortunately, constraint_name = szrelationship does not work; in this
sense: it does not return the displayed column value of my foreign key.
For example, if I have AuthorID (=5) as foreign key and Authors as
Foreign table, I expect that "szRelationship" returned AuthorName
(="Hemingway") but it return something like "reference1" and I don't
know what to do with it.

If there any way of getting the displayed column value of a foreign key
also using ADOX.catalog object or Openschema?
My database is Ms Access of course.

Many thanks,
Irena


Nov 13 '05 #2

Tom van Stiphout wrote:
Ok, sorry.

I start form the beginning. I want to guess, read the foreign keys in a
generic table. I have an ASP script.

So I can read the keys with ADOX.Catalog, with OpenSchema or with the
select query I was suggested by the site I wrote before.

I know the properties to read the foreign key column name, foreign key
table name, but not the property to read the foreign key display name
(as AuthorName of the example, but it could be something else).

Is there a property that returns me that column?

Here is the code that I use:

For each key in Catalog.Tables(sTAB).Keys
FKtab(i) = key.RelatedTable <-- returns the foreign table

if key.type=2 then ' foreign key
for each colkey in key.Columns
FKcol(i) = colkey.RelatedColumn <- return the foreign column
next
end if
i = i+1
Next
thanks,
cheers
irena

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jack | last post by:
i have a task as following: some body has right to access an html page,some body has no right,these right information are in database...sounds simple,get information from database,verify if the...
4
by: MLH | last post by:
In the late-70'ies, I was managing a biomechanical RDBMS. The mechanical part of it consisted of a 5-drawer Allsteel filing cabinet in the front office with customer file folders in it. The bio...
5
by: Add and Paste | last post by:
Dear Access developers, I have a lot of cut and pasting to do from Excel to an Access form. But instead of just pasting, I want to "add then paste" the value. Does anybody have a way to do this?...
4
by: selen | last post by:
Hello, My problem is that: I want to open a word document and writing something in it then save it.But it give me granting access error.and say that:To grant ASP.NET write access to a file,...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
4
by: marcnz | last post by:
Hi, I am working for a company which as a MS SQL backend and Access as front end. We update automatically each access db on the user local machine when a new feature has become available. We...
3
by: dstork | last post by:
Has anyone else experienced Access 2007 crashing when users right click on the subform (with the intention to use the copy feature in the shortcut menu). I went through Allen Browne's...
11
by: Simon van Beek | last post by:
Dear reader, By opening an application I get always the main Access window with the closing cross in the above right corner. Is there a possibility to make this closing cross invisible? ...
10
by: MeeMee | last post by:
Hi, I have a problem in one of the MS Access systems at work. I am using some database functions that requires the DAO reference. The system is working fine on my PC, however it occurs on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.