Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relationship name 1

Status
Not open for further replies.

aatif

Programmer
Dec 5, 2001
7
GB
Hello,
How can i find the name of relationship in the table, I want to use query
ALTER TABLE table DROP CONSTRAINT constraintName
if it is correct, but what abt constraintName how can i find out that...

Aatif
 
Try this query...

SELECT MSysRelationships.szRelationship
FROM MSysRelationships
WHERE (((MSysRelationships.szReferencedObject)=[Table Name?]));
 
Hi thanx for ur reply, that is really cool
But it didnt work when I tried to execute it through adodb.connection object then it gave me read privelage error,

[Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MSysRelationships'


Thanx
Aatif
 
Yes, locally I can run it .....
Problem is that i want to run it in remote machine, so I am using adodb.connection through ASP and trying to use execute function to run that query.

Aatif
 
It might be dying because of the parameter. Try building the sql in VBA and coding the parameter. i.e.


Sub RelationShipName(strTable As String)

Dim qryQuery As QueryDef
Dim strSQL As String

Set qryQuery = CurrentDb.QueryDefs("[Query Name]")

strSQL = "SELECT szRelationship FROM MSysRelationships WHERE szReferencedObject='" & strTable & "'"

qryQuery.SQL = strSQL

DoCmd.OpenQuery qryQuery.Name

End Sub

 
sorry I havent worked much on VB, plz tell me something abt VBA is it same as VB, sorry if it sounds stupid, but i dont have much experience on application development, only web development,

Thanx a lot
Aatif Malik
 
VBA is like a trial version of VB customized for each MS Office application- It doesn't have all the commands and functions in VB. Let say we have a form with a text box (txtBox) and a command button (cmdButton) this would be the code we would use to be able to type in the name of the table in the text box and the click the button to run the query.

Sub cmdButton_Click()

RelationShipName Me.txtBox

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top