Midtown Computer Systems Enterprise

Convenient web based access to our favorite computer related Usenet groups.
MCSE.MS is not affiliated with Microsoft corporation, Cisco corporation, Oracle, CompTIA or any other vendor.
Check our Computer Hardware forum | Cell Phones reviews

Go Back  MCSE > Microsoft Office suite > Access > Access Replication


Access Replication microsoft.public.access.replication

 
 
Thread Tools Display Modes
  #1  
Old 11-23-04, 07:08 PM
Michael Walsh
command button code
What would code look like that I could associate with a command button to
complete direct synchonization of users local copy of a databse with the
networked copy? Or where could I find help on this?

My users have gotten better at this, but a sync button would go a long way
towards helping them.

Additionally, any code that would determine whether the user was connected
to the network and then synchonize on open and close of their copy if
connected to the database would be useful.
  #2  
Old 11-25-04, 08:23 AM
K_Mueller K_Mueller is offline
Junior Member
Join Date: Nov 2004
Re: command button code
Sub synchronizeDB()  
Dim cloneDb As DAO.Database

On Error GoTo ERR_synchronizeDB
Screen.MousePointer = 11
strDefFile = "c:\RepDB.mdb"
strNetFile = "s:\NetDB.mdb"

Set cloneDb = DBEngine.Workspaces(0).OpenDatabase(strDefFile)
cloneDb.Synchronize strNetFile, dbRepImpExpChanges
Screen.MousePointer = 0
Exit Sub

ERR_synchronizeDB:
Screen.MousePointer = 0
MsgBox Error$
Exit Sub
End Sub

Best regards Klaus

Last edited by K_Mueller : 11-25-04 at 08:26 AM.
  #3  
Old 11-29-04, 10:07 AM
Michael Walsh
Re: command button code
Thanks

I have one more question though... rather than refer to a static database
path in the code, how can I refer to a dynamic datase path? That is, if the
database is saved in different paths i.e. "c:\Documents and
Settings\username\My Documents\RepDB.mdb" how do I set that value.

I assume there's way to set the value of strDefFile to the name of the
database that is executing the code.

"K_Mueller" wrote:

>
> Sub synchronizeDB()
> Dim cloneDb As DAO.Database
>
> On Error GoTo ERR_synchronizeDB
> Screen.MousePointer = 11
> strDefFile = "c:\RepDB.mdb"
> strNetFile = "s:\NetDB.mdb"
>
> Set cloneDb = DBEngine.Workspaces(0).OpenDatabase(strDefFile)
> cloneDb.Synchronize strNetFile, dbRepImpExpChanges
> Screen.MousePointer = 0
> Exit Sub
>
> ERR_synchronizeDB:
> Screen.MousePointer = 0
> MsgBox Error$
> Exit Sub
> End Sub
>
> Best regards Klaus
>
>
>
> --
> K_Mueller
> ------------------------------------------------------------------------
> Posted via http://www.mcse.ms
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message1244696.html
>
>

  #4  
Old 11-29-04, 07:09 PM
Michael Walsh
Re: command button code
I also wasn't sure how to call this procedure in the switchboard so I
converted it to a function I think and made the pathname dynamic. I do have
one question about this method of synchronization and conflict resolution.
Does it still work the same or will the conflict resolution manager have to
be called manually?

Here's the modified code...
Function Sync()
'Sub synchronizeDB()
Dim cloneDb As DAO.Database
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile)) &
strDBFile


On Error GoTo ERR_synchronizeDB
Screen.MousePointer = 11


strDefFile = CurrentDBDir
strNetFile = "\\netcopy.mdb"

Set cloneDb = DBEngine.Workspaces(0).OpenDatabase(strDefFile)
cloneDb.Synchronize strNetFile, dbRepImpExpChanges
Screen.MousePointer = 0
'Exit Sub
MsgBox ("Synchronization is complete")
GoTo exitpart

ERR_synchronizeDB:
Screen.MousePointer = 0
MsgBox Error$
MsgBox (CurrentDBDir)
'Exit Sub
'End Sub
exitpart:
End Function



"K_Mueller" wrote:

>
> Sub synchronizeDB()
> Dim cloneDb As DAO.Database
>
> On Error GoTo ERR_synchronizeDB
> Screen.MousePointer = 11
> strDefFile = "c:\RepDB.mdb"
> strNetFile = "s:\NetDB.mdb"
>
> Set cloneDb = DBEngine.Workspaces(0).OpenDatabase(strDefFile)
> cloneDb.Synchronize strNetFile, dbRepImpExpChanges
> Screen.MousePointer = 0
> Exit Sub
>
> ERR_synchronizeDB:
> Screen.MousePointer = 0
> MsgBox Error$
> Exit Sub
> End Sub
>
> Best regards Klaus
>
>
>
> --
> K_Mueller
> ------------------------------------------------------------------------
> Posted via http://www.mcse.ms
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message1244696.html
>
>

  #5  
Old 12-03-04, 07:09 PM
Michael Walsh
Re: command button code
The code works great, but I'm thinking that I should probably have all the
objects close and then reopen my switchboard so that the changes are
relfected based on the sync. Any ideas?

"Michael Walsh" wrote:
[vbcol=seagreen]
> I also wasn't sure how to call this procedure in the switchboard so I
> converted it to a function I think and made the pathname dynamic. I do have
> one question about this method of synchronization and conflict resolution.
> Does it still work the same or will the conflict resolution manager have to
> be called manually?
>
> Here's the modified code...
> Function Sync()
> 'Sub synchronizeDB()
> Dim cloneDb As DAO.Database
> Dim strDBPath As String
> Dim strDBFile As String
> strDBPath = CurrentDb.Name
> strDBFile = Dir(strDBPath)
> CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile)) &
> strDBFile
>
>
> On Error GoTo ERR_synchronizeDB
> Screen.MousePointer = 11
>
>
> strDefFile = CurrentDBDir
> strNetFile = "\\netcopy.mdb"
>
> Set cloneDb = DBEngine.Workspaces(0).OpenDatabase(strDefFile)
> cloneDb.Synchronize strNetFile, dbRepImpExpChanges
> Screen.MousePointer = 0
> 'Exit Sub
> MsgBox ("Synchronization is complete")
> GoTo exitpart
>
> ERR_synchronizeDB:
> Screen.MousePointer = 0
> MsgBox Error$
> MsgBox (CurrentDBDir)
> 'Exit Sub
> 'End Sub
> exitpart:
> End Function
>
>
>
> "K_Mueller" wrote:
>
 


Popular forums
A+ (A Plus) Windows 2000 Active directory Exchange 2000 information store
Network+ Windows XP Security Exchange 2000 server administration
MCSE .NET Web services SQL Server
Cisco certification ASP .NET SQL 2000 Programming
Windows 2000 Registry .NET XML Viruses


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:28 AM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright MCSE braindumps 2003-2006