Urgent Code Help Needed!!! PLEASE HELP (1 Viewer)

baguley

New member
Local time
Today, 13:32
Joined
Jul 12, 2002
Messages
5
Can anybody help me?

I am new to using code in my access database.

I am currently developing a front end back end database where the back end is a replica.

For security reasons I need to delete one of the tables from the front end using code because the relationships to other tables are stopping me from using a macro.

So far I have the following code where "company" is the table that I want to delete. When I run this code I get the error "An unexpected error (3452) occured: You can't make changes to the design of the database in this replica."

Here is the Code:

Private Sub Command24_Click()
'
' Deletes all relationships associated with a table.
'
' This is needed if you have a relationship on a linked table, and the
' source of the attachment has been moved/deleted. Without DAO, you wouldn't
' be able to delete the relationship in order to delete the table.
'
' You can also use this to delete relationships of non-linked tables.
'
Dim Db As DAO.Database, i As Integer
On Error GoTo DRErr
Set Db = CurrentDb
For i = Db.Relations.Count - 1 To 0 Step -1
If (Db.Relations(i).Table = "Company") Or (Db.Relations(i).ForeignTable = "Company") Then
Db.Relations.Delete Db.Relations(i).Name
End If
Next i
'
' Optional code to delete tabledef if it is a linked table
'
' If (db.TableDefs("Company").Attributes And dbAttachedTable) Then
' db.TableDefs.Delete "Company"
' Else
' MsgBox "Not a linked table."
' End If

DRExit:
Exit Sub

DRErr:
If Err.Number = 3265 Then
MsgBox "There is no table named " & "Company" & " in this database."
Else
MsgBox "An unexpected error (" & Err.Number & ") occurred: " & Err.Description
End If
Resume DRExit
End Sub


Thanks in advance
 

Travis

Registered User.
Local time
Today, 05:32
Joined
Dec 17, 1999
Messages
1,332
You can't make changes to the design of the database at this replica. (Error 3452)


Changes to the design of a replicated database can be made only at the Design Master. The replica you are attempting to change is not the Design Master for the replica set. Locate the Design Master and make your changes there.
 

baguley

New member
Local time
Today, 13:32
Joined
Jul 12, 2002
Messages
5
The front end isn't a replica and that's where the code is so I can't understand why it won't let me delete the relationships.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:32
Joined
Feb 19, 2002
Messages
43,346
The relationships are in the database that contains the physical tables which in your case would be the replica.
 

Users who are viewing this thread

Top Bottom