AppendDocLink to a unique doc in another db

Anyone know if it is possible to use AppendDocLink to unique value entered in db-a and find the doc with the value in db-b and once found appendlink to doc in richtext field in db-a? If you have any code that would be helpful.