Hi Tim,
Tim Miller wrote:
I'm pulling data into excel from a SQL database. Rather than create
several identical workbooks where each queries a different users
information, can I add some code at some level that matches the
[User_Name] field in the data to the Windows logged in user name on
the computer. Both are first intial + last name.
The one workbook would have several different data sources (different
SQL Views from the same database) and each would refresh
automatically upon open.
If you're using SQL Server, there is an suser_sname() function that will
return the current system user. If your query is using integrated
authentication (network credentials used instead of SQL Server login), then
you could add WHERE [User_Name] = suser_sname() to your queries in order to
filter by the connecting user.
--
Regards,
Jake Marx
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]