UserName Filter

damian

Registered User.
Local time
Today, 05:38
Joined
Jun 27, 2004
Messages
87
I’ve used ‘=Environ("UserName")’ in a text box on a form to capture the user name and would like to filter a combo box depending upon who the user is. The underlying table has the following fields and values:

FileLocation UserName1 UserName2

G:\ Form 314.doc Yes No
G:\ Form 315.doc No No
G:\ Form 668.doc Yes No

So if ‘UserName1’ logs on, he’ll only be able to view ‘G:\ Form 314.doc’ and ‘G:\ Form 668.doc’ in the drop down list.

Can anyone please advise me on the easiest method of achieving this?
 
tblFileLocations
FLocsID - Auto
UserName - Text (or UserID - number if you have a users table)
DocPath - text - 255

Sql:
strSql = "Select * from tblFileLocations where username='" & environ("username") & "'"

Open this as a recordset - read only (static) and populat the list with those mentioned for the user.

The table laid out this way allows you to assign more users at a later date without changing the table structure each time.


Vince
 
Sql

Being new to SQL I'm struggling on where to put -

strSql = "Select * from tblFileLocations where username='" & environ("username") & "'"

I've attempted to insert it into a query (SQL view) but with no success.
 

Users who are viewing this thread

Back
Top Bottom