PDA

View Full Version : [SOLVED:] Get Environ Variable on Opening Access db



stanl
09-08-2015, 01:27 PM
Where I work, IT has set up the Username Variable on each PC to equal the employee ID (alphanumeric). I would like to create a generic access file with links to SQL Server tables and some basic query, form and report options to be distributed to supervisors (from the network).

The SQL Server data is linked to query employees by supervisor ID. So I would like to have access discover the ID from the environment USERNAME as a global variable so that all of the queries, forms and reports would only retrieve data for that ID's employees when run.

Hope this makes sense.

jonh
09-09-2015, 11:49 AM
Add a textbox to a splash screen or password entry screen that remains open but hidden.
Set the value using =environ("username").
Filter your query via the textbox, e.g.

where id=" & forms!frmsplash!txtuser

stanl
09-10-2015, 12:59 PM
That works, Thanks