Applies To Document object, QueryDef object, TableDef object.
Description
Sets or returns a value on a table, query, form, report, macro, or module that you do not want to replicate when the database is replicated (Microsoft Jet workspaces only).
Note Before getting or setting the KeepLocal property on a TableDef, or QueryDef object, you must create it by using the CreateProperty method and append it to the Properties collection for the object. Settings and Return Values The setting or return value is a Text data type. If you set this property to "T", the object will remain local when the database is replicated. You can't use the KeepLocal property on objects after they have been replicated. Remarks Once you set the KeepLocal property, it will appear in the Properties collection for the Document object representing the host object. Before setting the KeepLocal property, you should check the value of the Replicable property. After you make a database replicable, all new objects created within the Design Master, or in any other replicas in the set, are local objects. Local objects remain in the replica in which they're created and aren't copied throughout the replica set. Each time you make a new replica in the set, the new replica contains all the replicable objects from the source replica, but none of the local objects from the source replica. If you create a new object in a replica and want to change it from local to replicable so that all users can use it, you can either create the object in or import it into the Design Master. Be sure to delete the local object from any replicas; otherwise, you will encounter a design error. After the object is part of the Design Master, set the object's Replicable property to True. The object on which you are setting the KeepLocal property might have already inherited that property from another object. However, the value set by the other object has no effect on the behavior of the object you want to keep local. You must explicitly set the property for each object.See Also CreateProperty method, Replicable property.
Example The following example appends the KeepLocal property to the properties collection of a document object for the Utilities module in the Northwind database. You set this property on an object (such as a table) before a database is made replicable. When the database is converted to a Design Master, the object you specified to remain local will not be dispersed to other members of the replica set. Adjust the path to Northwind.mdb as appropriate to its location on your computer.Sub KeepLocalNWObjectX()
Dim dbsNorthwind As Database
Dim docTemp As Document
Dim prpTemp As Property
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Set docTemp = dbsNorthwind.Containers("Modules"). _
Documents("Utility Functions")
Set prpTemp = doc.CreateProperty("KeepLocal", _
dbText, "T")
docTemp.Properties.Append prpTemp
dbsNorthwind.Close
End Sub
The following code sets the KeepLocal property on the specified TableDef object to "T". If the KeepLocal property doesn't exist, it is created and appended to the table's Properties collection, and given a value of "T".
Sub SetKeepLocal(tdfTemp As TableDef)
On Error GoTo ErrHandler
tdfTemp.Properties("KeepLocal") = "T"
On Error GoTo 0
Exit Sub
ErrHandler:
Dim prpNew As Property
If Err.Number = 3270 Then
Set prpNew = tdfTemp.CreateProperty("KeepLocal", _
dbText, "T")
tdfTemp.Properties.Append prpNew
Else
MsgBox "Error " & Err & ": " & Error
End If
End Sub