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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete relation in MS Access Database

Status
Not open for further replies.

Charlix

Programmer
Nov 19, 2002
85
US
Hi,
I get the following error message when I try to remove a one to many relationship in my database programatically:

*******
arguments are of the wrong type, out of acceptable range or are in conflict with one another
*******

This is the code I am using on my asp page"

*******************
Set db = CreateObject("ADODB.Connection")
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\CapsDb1.mdb"

set rel = db.CreateRelation("321", "Multi Table", "Records Table")
rel.attributes = dbRelationDontEnforce
Set fld = rel.CreateField("MID")
fld.ForeignName = "MID"
rel.Fields.Append fld
db.Relations.Append rel

db.Relations.Update
*********************

How do I fix this error?
Thanks,

Charlix
 
I don't know how to do what you want but :

a) you appear to be creating a relationship rather than deleting one.
b) except for the connection, the code you are using is for DAO, not ADO (or rather ADOX for structural elements)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top