Autofilter records based on user name

Tiosylanyl

New Member
Joined
Jul 31, 2006
Messages
48
Hello all,

I'm working on a database with a username/password login. Upon login, it opens a switchboard that leads to other forms that users will be able to view their records.

I'm trying to set up an automatic filter based on the user name, as described on this link: http://www.databasedev.co.uk/filter_current_user.html

I've already set up a module for the code that is supposed to capture the current user ID(basCurrentUser), the hidden form and AutoExec macro for it, however, it still isn't working.

I'm sure it has to do with ensuring that I've changed the form/field names to what I'm using in the code, but after playing with it for a while, I still haven't come up with the solution.

Here are the names of the Forms/fields I have:

Log in form:
Database Logon
cboEmployee
txtPassword


Hidden table:
Current User Login
LoginName


Anyone have an idea as to what I may be missing?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

tja128

New Member
Joined
Sep 12, 2006
Messages
48
One solution

I have created a company wide secure database for my company to use. It is important that no two departments can see each others data. One simple way to achieve this is to first decide on the field you will filter on. In my case it was department. Next I created a macro with the following Actions:
OpenForm: FormName
ApplyFilter: Filter Name: Leave Blank, Where condition: [FormName]![Department]="IT"
Save it as IT_Filter

I created this macro for each division.
Assined this macro to the IT group of privelages

Created a command button on the switchboard that OnClick opens macro IT_Filter.

Keep in mind I also created custom toolbars that did not have the filter button on it. I also took away the privelege to Right-click and customize toolbars. They are very limited in what they can do. Of course if you cannot remove these features, users can remove the filter. With these options enabled, you would need an alternate approach.

Hope this works for you because it is quick and easy and works!
 

Forum statistics

Threads
1,136,368
Messages
5,675,358
Members
419,565
Latest member
Phil57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top