Dim session As New notessession
Dim db As notesdatabase
Set db=session.currentdatabase
If db.server="" Then
Msgbox "This function can only be performed on the server replica.", 0 + 64, "Access Denied"
Exit Sub
Else
'database is on server, continue with code
End If