I can add this however. If you want to link to a spreadsheet only under certain conditions, that is possible. I use the following code to establish a link to a separate DB on the local machine of the user. This builds a link between the two databases so they can communicate freely and pass credentials between them.
Code:
Set oTD = CurrentDb.TableDefs("tblCred")
If Err.Number = 3265 Then
DoCmd.TransferDatabase acLink, "Microsoft Access", Environ("userprofile") & "\My Documents\Lift\Credentials.mdb", acTable, "tblCred", "tblCred"
DoCmd.TransferDatabase acLink, "Microsoft Access", Environ("userprofile") & "\My Documents\Lift\Credentials.mdb", acTable, "tblWebCreds", "tblWebCreds"
End If