DoEvents with Active X Progress Bar 6.0

G

Guest

Using the following Code the Progress Bar does NOT update. Everything else
works great in an Access 2002 Project using Anonymous Merge Pull Subscription
over the Internet. It is based on the ReplSamp.vbp in

C:\Program Files\Microsoft SQL
Server\80\Tools\DevTools\Samples\sqlrepl\replctrl\vb\replsamp.vbp

Probably I am NOT using the DoEvents function correctly.


Option Compare Database
Option Explicit

Private WithEvents SQLMerge As SQLMerge

Private Sub MergePublication_Click()
On Error Resume Next
ProgressBar.Value = 0
ProgressLabel.Caption = "Starting Merge Replication"
MergePublication.Enabled = False
Dim oErrorObject As SQLReplError
Dim mobjMerge As SQLMERGXLib.SQLMerge
Set mobjMerge = New SQLMERGXLib.SQLMerge
' Removed parameters for mobjMerge.Publisher mobjMerge.Subscriber
mobjMerge.Initialize
mobjMerge.Run
mobjMerge.Terminate
ProgressBar.Value = 0
ProgressLabel.Caption = ""
MergePublication.Enabled = True
End Sub

Private Function SQLMerge_Status(ByVal Message As String, ByVal Percent As
Long) As STATUS_RETURN_CODE
ProgressBar.Value = Percent
ProgressLabel.Caption = Message
Me.Refresh
DoEvents
SQLMerge_Status = SUCCESS
End Function

-- TIA
Aubrey Kelley
 
B

Brendan Reynolds

Try Me.Repaint instead of Me.Refresh (or as well as, if you need Me.Refresh
for some other purpose).
 
G

Guest

RESOLVED! The error was that inside the Sub MergePublication_Click the Object
used was mobjMerge while the Progress bar was monitoring SQLMerge events.
dropping:
Dim mobjMerge As SQLMERGXLib.SQLMerge
Set mobjMerge = New SQLMERGXLib.SQLMerge
and using SQLMerge throughout, it works great now.
Oh, and DoEvents is only needed in the Function, not the _Click Event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top