Access and Merge Replication

  • Hi,

    I have a problem when merge replication is active on my database. Without it I can open a keyset recordset, add a record and will have the Identity Key  value returned to the recordset when updated. However, When merge replication is active the identity key does not get returned, I get 0 instead.

    Does anyone know why this is happening ?.

    Thanks

    Stuart

     

  • Hi Stuart,

    isn't merge replication relevant to SQL Server rather than Access?

  • Hi Grovelli,

    The problem is occuring in my Access application - the merge replication works fine so I did not consider there to be a problem there. 

     

  • At a first guess, maybe some thing to do with the replication is firing a trigger, thus altering the value of the last identity created.

    Are you using @@identity or scope_identity() to retrieve the identity value generated?

  • Hi Chris,

    Thanks for looking at this.

    My code in simple terms is as follows :

    Dim intIdentReturn as Integer

    Dim SqlRs as Adodb.Recordset

    With SqlRs

        .Open "tblName", SqlConn, adOpenKeyset, adLockPessimistic

        .Addnew

         !Fieldname = "AddValueHere"

        .Update

        intIdentReturn = !IdentityKeyField

    End With

    This works fine without merge replication but as soon as its on it returns 0 to intIdentReturn.

    Thanks

    Stuart

  • The problem is definitely caused by the insert trigger created by merge replication.

    Thanks Chris:

    Stuart

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply