OpenByReplicaID fails - sometimes. re-saving helps - sometimes

I have a workflow appliation that involves several databases. When the user composes a document (database A), code in a subform pulls workflow info (routing info etc) from a second database (database B). That seems to be working fine for hundreds of composes per day (and has been for years).

There is another database (database C) where users open an existing doc and click on a button that composes a doc in database A. This uses the standard subform again which pulls workflow info from database B. Control then returns to database C which populates some fields on the new document with info from the starting doc in database C. This is the process that is having sketchy performance in our production environment. (works like a champ on the test server, of course).

The code seems to be having trouble with the OpenByReplicaID command that I’m using to open database B. But that line of code works fine when you compose from database A.

I saw a posting that suggested ‘recompiling’ my code and trying it again. I re-saved the subform and on one server in the cluster it seemed to help - for a while - then it started failing again. On the other server in the cluster this doesn’t help.

I’m baffled. When I try to debug I can only debug the code in database C up to the point where the doc gets composed in database A - debugging stops at that point, so I can’t specifically see what the variable values are. Since this issue is only happening in Production I can’t start throwing messageboxes in. The process works fine for most users.

No errors are showing up in the server logs. The database that I’m trying to open (Database B) only has 900-ish docs - although the doc counts are off by 3 between the 2 replicas. I plan to create new replicas tonight after hours. I’ve tried compacting the database, clearing the replication history.

Any other ideas?

Subject: OpenByReplicaID fails - sometimes. re-saving helps - sometimes

Are you certain that the problem is with OpenByReplicaID? How are you determining the Replica ID for the command - is it hard-coded or being looked up? If looked up, maybe the problem is not with the OpenByReplicaID command but the value being passed to it - you may be getting the value form the “current” database which in the second scenario is database C and not A.

Subject: RE: OpenByReplicaID fails - sometimes. re-saving helps - sometimes

I’m not entirely certain that it is the OpenByReplicaID that is failing, but the user is getting the message “Unable to Open Supporting Documents Database.”

code snippet-----------------

DbServ = currserver

If suptdb.OpenByReplicaID(DBServ, “862567910046393B”) Then

Else

Messagebox “Unable to Open Supporting Documents Database.”

Exit Sub

End If

’ go get the info from the supporting docs database &

'load it into the doc I’m creating

end of code snippet ----------------------

DBServ is the same for all databases in this process, and it gets reset almost every time it’s used.

When I turn the debugger on it doesn’t debug the lines in this part of the code - just the lines from the initial calling button. So I can’t see the values surrounding that error.

Over the weekend I created new replicas of the Supporting Documents database. The doc count is now only off by 1 instead of 4. The error is still happening when I try to run it from production.

Any other ideas would be appreciated - I’ve hit a bit of a wall.