I have a MS Access project that connects to an MSDE database on the same laptop. I also have the same MSDE located on a server. Merge replication is set up between the two and is currently controlled using Window Synchronization Manager. Works good. I want to place merge control in the Access project so that the endusers only need to use the Access project to initiate replication. I'm using the ActiveX Merge Control to try to do this. I found an article in SQL Server Magazine that uses the attached code. Listing 1 is a classmodule that allows access to the merge control's Status Event. Listing 2 is the merge replication function. When I run the Replication_Merge function in the VBE Immeadiate Pane I get the Run-Time error 424: Object Required. The 4th line of listing 2 "Set Merge_Control = New_Merge.SQlM" is highlighted yellow when I debug. The contents of the article are also attached.
LISTING 1: Creating a Class Module That Uses the Status Event
Public WithEvents SQlM As SQLMerge
Private Sub Class_Initialize()
Set SQlM = New SQLMerge
Private Sub Class_Terminate()
Set SQlM = Nothing
Private Function SQLM_Status(ByVal Message As String, ByVal Percent As Long) As SQLMERGXLib.STATUS_RETURN_CODE
Debug.Print Message & " " & Percent & "% Done"
LISTING 2: The Replication_Merge Function
Public New_Merge As New clsMerge
Public Function Replication_Merge()
Dim Merge_Control As SQLMerge
Set Merge_Control = New_Merge.SQlM
'Set the publisher properties
.Publisher = "Your Server Name"
.PublisherSecurityMode = DB_AUTHENTICATION
.PublisherLogin = "sa"
.PublisherPassword = ""
.PublisherDatabase = "Pubs"
.Publication = "pubs_to_MSDE"
.PublisherNetwork = TCPIP_SOCKETS
.PublisherAddress = "www.yourcompany.com"
'Set the distributor properties
.Distributor = "Distributer Server Name"
.DistributorSecurityMode = NT_AUTHENTICATION
'Set your local subscriber properties
.Subscriber = "The Local Machine Name/Server Name"
.SubscriberSecurityMode = DB_AUTHENTICATION
.SubscriberDatasourceType = SQL_SERVER
.SubscriberLogin = "sa"
.SubscriberPassword = ""
.SubscriberDatabase = "pubs_local"
.SubscriptionType = ANONYMOUS