NAS - "there was a problem connecting to the server" while on other networks
What you need is a network location manager program, typically these allow you to perform certain actions (e.g. connect to a network drive) when the machine is on some networks and not on others. Several years ago I was using one, now defunct, so I can't recommend any from experience. What I found now are things like Sidekick ($29), Control Plane (free).  

You can also do this with a script (e.g. Login Item, if you log off or shutdown the machine when moving it from home to work or vice versa, or cron job) to determine the network the machine is on and depending on it to connect to the network drive (if not already connected) or not.