Solved

Get  Run-time Error '424': Object Required when trying to implement an ActiveX Merge Control in an MS Access Project

Posted on 2008-10-11
3
1,024 Views
Last Modified: 2013-12-05
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.

Thanks
LISTING 1: Creating a Class Module That Uses the Status Event
 
Public WithEvents SQlM As SQLMerge
 
Private Sub Class_Initialize()
   Set SQlM = New SQLMerge
End Sub
 
Private Sub Class_Terminate()
    Set SQlM = Nothing
End Sub
 
Private Function SQLM_Status(ByVal Message As String, ByVal Percent As Long) As SQLMERGXLib.STATUS_RETURN_CODE
    Debug.Print Message & " " & Percent & "% Done"
End Function
 
 
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
    
 
With Merge_Control
	'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
    
    	.Initialize
	.Run
	.Terminate
End With
        
 
End Function

Open in new window

SQLMagArticle.doc
0
Comment
Question by:4632474
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Expert Comment

by:dannywareham
ID: 22696742
If you debug the code, do you get the same error?
I'm thinking that this could be a references issue.
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 250 total points
ID: 22701986
I pasted your code into an adp, i.e. first part as new class module named clsMerge, and second part as new module; in VBA, added reference to Microsoft SQL Merge Control 8, then ran Replication_Merge in immediate panel, and it worked. Of course it returned error message about not finding the subscription ("The process could not connect to Subscriber 'The Local Machine Name/Server Name'. 0% Done") , but not "object required".
0
 

Author Closing Comment

by:4632474
ID: 31505365
Thanks - I had the function in a module with a few other functions used throughout the project.  I put it in its own module and it works.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question