Hello all!
I need to automatically delete all the relationships in my database and I've found on internet a code that returns:
Code:
Run-time error '3211'
The database engine could not lock the table 'X' because
it is already in use by another user or process.
The code is:
Code:
Private Sub Command39_Click()
Dim db As Database
Dim rex As Relations
Set db = CurrentDb()
Set rex = db.Relations
Do While rex.Count > 0
Debug.Print rex(0).Name
rex.Delete rex(0).Name
Loop
End Sub
I have no table in use. The problem could be the multiple relationships that I have from table 'X' to other tables.
Is there any way to improve this code?
Thx!