Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Replication / December 2004

Tip: Looking for answers? Try searching our database.

command button code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Walsh - 23 Nov 2004 20:07 GMT
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.
K_Mueller - 25 Nov 2004 14:23 GMT
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 Klau

-
K_Muelle
Michael Walsh - 29 Nov 2004 14:47 GMT
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.

> Sub synchronizeDB()  
> Dim cloneDb As DAO.Database  
[quoted text clipped - 23 lines]
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message1244696.html
Michael Walsh - 29 Nov 2004 18:46 GMT
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

> Sub synchronizeDB()  
> Dim cloneDb As DAO.Database  
[quoted text clipped - 23 lines]
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message1244696.html
Michael Walsh - 03 Dec 2004 22:25 GMT
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?

> 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
[quoted text clipped - 62 lines]
> > ------------------------------------------------------------------------
> > View this thread: http://www.mcse.ms/message1244696.html
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.