Re: command button code

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Michael Walsh (MichaelWalsh_at_discussions.microsoft.com)
Date: 12/03/04


Date: Fri, 3 Dec 2004 14:25:05 -0800

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:

> 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
> >
> >


Quantcast