RenameDatabase

I have placed the following code in the Database PostOpen Event in order to redirect users from an old Notes Server to a new Notes Server. It works in redirecting users; however, the message “Database is currently open - it cannot be renamed, removed or deleted” appears during the relocation. Does anyone know how I can get rid of this message. This will confuse users.

CurrentReplica:=@DbName;

NewServer:=“aaaaaa/bbbbbb”;

NewFilename:=“Apps\IT\security.nsf”;

@PostedCommand([FileCloseWindow]);

@PostedCommand([RenameDatabase]; CurrentReplica; NewServer );

@PostedCommand([FileOpenDatabase]; NewServer:NewFilename)

Subject: RenameDatabase

the code in PostOpen is likely running in both replicas. Add an if statement so it doesn’t run if opened on the new server. This should work (not tested):

CurrentReplica:=@DbName;

NewServer:=“aaaaaa/bbbbbb”;

NewFilename:=“Apps\IT\security.nsf”;

@If(@Subset(CurrentReplica; 1) = NewServer; @Return(“”); “”);

@PostedCommand([FileCloseWindow]);

@PostedCommand([RenameDatabase]; CurrentReplica; NewServer );

@PostedCommand([FileOpenDatabase]; NewServer:NewFilename)