In a VBA context, using a sql command or a script with osql or...? I have been doing this for a long time with the equivalent in MS Access - a custom function often referred as CurrentUserInGroup().

Also, I would like to be able to open a connection with a SQL dialog box showing the user, not the server (or field unabled) and the password in blank. I do this just by opening a default form in Access with a SQL recordsource.

I connect through a file DSN using MS SQL Server Native Client 11.0.