Object variable not set

I get an “Object variable not set” error in MS Outlook when I open a document link sent from a button in a Lotus Notes database.

It works fine if opened in Lotus Notes and the same code in other databases works if opened in MS Outlook or Lotus Notes.

Here is the code (in formula):

@Command([FileSave]);

FIELD Name_Manager := Name_Manager;

FIELD Name_Others := Name_Others;

FIELD Name_Employee := Name_Employee;

@If(Name_Manager = “Joe Smith”; @Set(“sendto”; “Joe Smith/First Admin Group/ABC”); “”);

@If(Name_Manager = “Joe Doe”; @Set(“sendto”; “Joe Doe/First Admin Group/ABC”); “”);

@If(Name_Manager = “Joe Cool”; @Set(“sendto”; “Joe Cool/Second Admin Group/ABC”); “”);

@Command([ViewRefreshFields]);

@MailSend(sendto;Name_Others;“”;“Vacation Request”;“A new vacation request was submitted for your approval by “+Name_Employee+@NewLine + “Here is a link to that document->”;””;[IncludeDoclink]);

@Command([FileSave]);

@Command([FileCloseWindow])

Subject: Object variable not set

Nevermind - it had nothing to do with the button, I found the cause in PostOpenQuery