I'm not understanding what you are saying about the usrName2 being able to access a different database simply by using a different user name and password. That makes no sense whatsoever because of the way the DSN's work. It doesn't just select one database if you use one user name and password and a separate database if you use a different user name and password. It only selects the database that was selected at the time you set up the DSN.
So yes, you would need two DSN's - one for each database. Then you can modify your procedure to pass it the values you need when you need them:
Code:
Public Sub reLink(strDSN As String, strUID As String, strPWD As String)
Dim connectString As String
connectString = "ODBC;DSN=" & strDSN & ";Server=aaa;Uid=" & strUID & ";Pwd=" & strPWD
Call createLink("TABLE_NAME", connectString)
End Sub
Private Function createLink(tbLName As String, connectString As String)
DoCmd.TransferDatabase TransferType:=acLink, DatabaseType:="ODBC Database", DatabaseName:=connectString, ObjectType:=acTable, Source:=tbLName, Destination:=tbLName, StructureOnly:=False, StoreLogin:=True
End Function