473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Replication via code

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
Nov 13 '05 #1
6 7445
On Wed, 8 Jun 2005 13:33:37 +0100, "John" <Jo**@nospam.infovis.co.uk>
wrote:

Look up the Synchronize method in the help file.
-Tom.

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


Nov 13 '05 #2
Can't find it. Search in both access 2000 help and access 2000 visual basic
help. Can you let me know the syntax?

Thanks

Regards
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:fk********************************@4ax.com...
On Wed, 8 Jun 2005 13:33:37 +0100, "John" <Jo**@nospam.infovis.co.uk>
wrote:

Look up the Synchronize method in the help file.
-Tom.

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

Nov 13 '05 #3
Synchronizes two replicas. (Microsoft Jet databases only).

Syntax

database.Synchronize pathname, exchange

The Synchronize method syntax has the following parts.

Part Description
database An object variable that represents a Database object that is
a replica.
pathname A String that contains the path to the target replica with
which database will be synchronized. The .mdb file name extension is
optional.
exchange Optional. A constant indicating which direction to
synchronize changes between the two databases, as specified in Settings.
Settings

You can use the following constants in the exchange argument. You can use
one of the first three constants with or without the fourth constant.

Constant Description
dbRepExportChanges Sends changes from database to pathname.
dbRepImportChanges Sends changes from pathname to database.
dbRepImpExpChanges (Default) Sends changes from database to pathname,
and vice-versa, also known as bidirectional exchange.
dbRepSyncInternet Exchanges data between files connected by an
Internet pathway.
Remarks

You use Synchronize to exchange data and design changes between two
databases. Design changes always happen first. Both databases must be at the
same design level before they can exchange data. For example, an exchange of
type dbRepExportChanges might cause design changes at a replica even though
data changes flow only from the database to pathname.

The replica identified in pathname must be part of the same replica set. If
both replicas have the same ReplicaID property setting or are Design Masters
for two different replica sets, the synchronization fails.

When you synchronize two replicas over the Internet, you must use the
dbRepSyncInternet constant. In this case, you specify a Uniform Resource
Locator (URL) address for the pathname argument instead of specifying a
local area network path.

Note You can't synchronize partial replicas with other partial replicas. See
the PopulatePartial method for more information.

Synchronization over the Internet requires the Replication Manager, which is
only available in the Microsoft Office 97, Developer Edition.

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:42*********************@news-text.dial.pipex.com...
Can't find it. Search in both access 2000 help and access 2000 visual basic help. Can you let me know the syntax?

Thanks

Regards
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:fk********************************@4ax.com...
On Wed, 8 Jun 2005 13:33:37 +0100, "John" <Jo**@nospam.infovis.co.uk>
wrote:

Look up the Synchronize method in the help file.
-Tom.

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

Thanks

Regards


Nov 13 '05 #4
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:#q**************@TK2MSFTNGP09.phx.gbl:
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.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #5
What happens when there is a conflict? Does the command come up with a
conflict resolution dialog or raises an error?

Thanks

Regards

"Ian Davies" <ia***************@virgin.net> wrote in message
news:l5******************@newsfe1-gui.ntli.net...
Synchronizes two replicas. (Microsoft Jet databases only).

Syntax

database.Synchronize pathname, exchange

The Synchronize method syntax has the following parts.

Part Description
database An object variable that represents a Database object that is
a replica.
pathname A String that contains the path to the target replica with
which database will be synchronized. The .mdb file name extension is
optional.
exchange Optional. A constant indicating which direction to
synchronize changes between the two databases, as specified in Settings.
Settings

You can use the following constants in the exchange argument. You can use
one of the first three constants with or without the fourth constant.

Constant Description
dbRepExportChanges Sends changes from database to pathname.
dbRepImportChanges Sends changes from pathname to database.
dbRepImpExpChanges (Default) Sends changes from database to pathname,
and vice-versa, also known as bidirectional exchange.
dbRepSyncInternet Exchanges data between files connected by an
Internet pathway.
Remarks

You use Synchronize to exchange data and design changes between two
databases. Design changes always happen first. Both databases must be at
the
same design level before they can exchange data. For example, an exchange
of
type dbRepExportChanges might cause design changes at a replica even
though
data changes flow only from the database to pathname.

The replica identified in pathname must be part of the same replica set.
If
both replicas have the same ReplicaID property setting or are Design
Masters
for two different replica sets, the synchronization fails.

When you synchronize two replicas over the Internet, you must use the
dbRepSyncInternet constant. In this case, you specify a Uniform Resource
Locator (URL) address for the pathname argument instead of specifying a
local area network path.

Note You can't synchronize partial replicas with other partial replicas.
See
the PopulatePartial method for more information.

Synchronization over the Internet requires the Replication Manager, which
is
only available in the Microsoft Office 97, Developer Edition.

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:42*********************@news-text.dial.pipex.com...
Can't find it. Search in both access 2000 help and access 2000 visual

basic
help. Can you let me know the syntax?

Thanks

Regards
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:fk********************************@4ax.com...
> On Wed, 8 Jun 2005 13:33:37 +0100, "John" <Jo**@nospam.infovis.co.uk>
> wrote:
>
> Look up the Synchronize method in the help file.
> -Tom.
>
>
>>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
>>
>



Nov 13 '05 #6
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:42*********************@news-text.dial.pipex.com:
What happens when there is a conflict? Does the command come up
with a conflict resolution dialog or raises an error?


No, it doesn't. You must check for conflicts manually, or use code
to check for conflicts.

If there are conflicts, there will be new conflict tables for each
table having conflicts. If the original table was named tblPerson,
the conflict table will be called tblPerson_Conflicts (or maybe it's
tblPerson_Conflict -- I can't remember).

To check for conflicts, do this:

Dim dbLocalReplica As DAO.Database
Dim strLocal As String
Dim tdf As DAO.TableDef
Dim strTableName As String
Dim strConflictTables As String
Dim strMsg As String

strLocal = "[path/name of local replica]"
Set dbLocalReplica = DBEngine(0).OpenDatabase(strLocal)
For Each tdf In dbLocalReplica.TableDefs
strTableName = tdf.Name
If Right(strTableName, 10) = "_Conflicts" Then
strConflictTables = strConflictTables & ", " _
& Left(strTableName, Len(strTableName) - 10)
End If
Next tdf
Set tdf = Nothing
dbLocalReplica.Close
Set dbLocalReplica = Nothing

If Len(strConflictTables) <> 0 Then
strMsg = "There are conflicts in these tables:"
strMsg = strMsg & vbCrLf & " " & vbCrLf
strMsg = strMsg & Mid(strConflictTables, 3)
MsgBox strMsg, vbExclamation, "Conflicts Found!"
End If

You could then open the replica in Access for the end user and the
built-in error dialog for conflicts/errors would pop up.

Or, you could design your own conflict resolver, but that's quite
complex. There are instructions for how to do this in the Access
Developers Handbook, but note that the A2K version uses JRO, which I
simply wouldn't recommend.

The problem with using the A97 version, though, is that replication
was significantly changed from Jet 3.5 to Jet 4.0, with the
elimination of standalone replication errors (data errors and schema
errors), or, more correctly, the treating of replication errors as a
form of conflict.

Just reviewing the code there, however, I see some things I never
knew before, that the MSysSideTables table includes a list of
conflict tables, so, instead of the code above, you could do this:

Dim rs As DAO.Recordset
Dim strSQL As String
Dim strTableList As String

If dbLocalReplica.TableDefs("MSysSideTable").RecordCo unt <> 0 Then
strSQL = "SELECT MSysTableGuids.TableName, "
strSQL = strSQL & "MSysSideTables.SideTable AS ConflictTable "
strSQL = strSQL & "FROM MSysSideTables, MSysTableGuids "
strSQL = strSQL & "WHERE MSysTableGuids.s_GUID=[TableGuid] "
strSQL = strSQL & "ORDER BY MSysTableGuids.TableName;"
Set rs = dbLocalReplica.OpenRecordset(strSQL)
rs.MoveFirst
Do While Not rs.EOF
strTableList = strTableList & vbCrLf & rs!TableName
strTableList = strTableList & ": " & rs!ConflictTable
rs.MoveNext
Loop
End If
strMsg = "There are conflicts in these tables:"
strMsg = strMsg & vbCrLf & " " & vbCrLf
strMsg = strMsg & Mid(strTableList , 3)
MsgBox strMsg, vbExclamation, "Conflicts Found!"

I'm not sure that's easier! I do believe that the test to see if
there are any conflicts will definitely be faster, though, as it
doesn't require a loop through the TableDefs collection.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andy K | last post by:
Hi , Finally i was able to setup my replication process between two databases . For those who were not following my story , i was trying to setup a replication between two databases on...
4
by: Andi Plotsky | last post by:
I need to synchronize 3 databases (1 Master and 2 replicas). I thought I'd give the Replica feature in Access2000 a whirl. I'm not sure I'm THAT impressed.....but maybe I'm just doing something...
1
by: Andrew Chanter | last post by:
I developed 3 different replicated database applications in MS Access for 3 different corporate clients in Access 97 several years ago to enable data to be shared across wide area networks. I...
3
by: SimonDB | last post by:
The replication of my database was successful and it works well. I can modify tables and forms, except for one thing : VBA ! I can’t add code in VBA, the error message : "incorrect data format". I...
6
by: John | last post by:
Hi We have an access app (front-end+backend) running on the company network. I am trying to setup replication for laptop users who go into field and need the data synched between their laptops...
3
by: dlesandrini | last post by:
I need advice about my decision to go with Replication in general. This post was placed on the Microsoft Replication newsgroup, but I really value the feedback that comes from this group as well. ...
56
by: Raphi | last post by:
Hi, I've been using an Access application I wrote for an office with the front-end stored on all computers and the back-end on one of them serving as an Access file server. Now we're moving...
9
by: David W. Fenton | last post by:
See: Updated version of the Microsoft Jet 4.0 Service Pack 8 replication files is available in the Download Center http://support.microsoft.com/?scid=kb;en-us;321076 This includes the Jet 4...
2
by: David Parker | last post by:
Hi. I'm new to postgresql in general, and have been tasked with coming up with a replication solution for our postgresql based application. Assuming we don't bite off trying to roll our own...
3
by: Gert van der Kooij | last post by:
Hi, Our SQL Replication is between DB2 databases on Windows servers. I'm searching for the document which tells me how to migrate our SQL Replication environment from V8 to V9 (we also need to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.