Replication via code

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have a front-end/back-end access app. I have created a replication set
between the backend on a server an the backend on a laptop. My question is;
How can I cause the synchronisation to happen via code? Basically I need to
give the user an option to press a button (or menu option) on the laptop
when the laptop is connected to the server/network for synchronisation to
happen.

Thanks

Regards
 
I have a front-end/back-end access app. I have created a
replication set between the backend on a server an the backend on
a laptop. My question is; How can I cause the synchronisation to
happen via code? Basically I need to give the user an option to
press a button (or menu option) on the laptop when the laptop is
connected to the server/network for synchronisation to happen.

In form design, drop a command button on your form. If the wizard
pops up, dismiss it.

Name your command button (something like "cmdSynchronize").

In the command button's properties, on the EVENTS tab, choose
OnClick, and click the ... button. Choose CODE (not Macro).

For the code, you'll need something like this:

Dim dbSynch As DAO.Database
Dim strLocal As String
Dim strRemote As String

strLocal = "[path/name of the local laptop replica]"
strRemote = "[path/name of the server replica]"
Set dbSynch = DBEngine(0).OpenDatabase(strLocal)
dbSynch.Synchronize strRemote

dbSynch.Close
Set dbSynch = Nothing

Now, that's sufficient for doing a direct synch when connected to
the LAN. You wouldn't want to use this connected over dialup.

Also, it does nothing to check for conflicts (or errors, if you're
using A97). But those can be checked for and resolved manually by
opening the data files in Access.
 

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

Back
Top