R Roger Carlson Feb 7, 2005 #2 I'd place it in a function in a General Module. Something like this: Function ComputerUserName() As String ComputerUserName = Environ("UserName") End Function Then use the function in the query: SELECT * FROM MyTable WHERE ComputerUser = ComputerUserName(); -- --Roger Carlson Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access questions in your Email? Free subscription: http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
I'd place it in a function in a General Module. Something like this: Function ComputerUserName() As String ComputerUserName = Environ("UserName") End Function Then use the function in the query: SELECT * FROM MyTable WHERE ComputerUser = ComputerUserName(); -- --Roger Carlson Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access questions in your Email? Free subscription: http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
D Douglas J. Steele Feb 7, 2005 #3 While that will work, I'd advise very strongly not relying on the environment variable to get user name: it's trivial to reset them. Instead, use API calls, which cannot be circumvented. See http://www.mvps.org/access/api/api0008.htm at "The Access Web" for a complete sample.
While that will work, I'd advise very strongly not relying on the environment variable to get user name: it's trivial to reset them. Instead, use API calls, which cannot be circumvented. See http://www.mvps.org/access/api/api0008.htm at "The Access Web" for a complete sample.