Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
User Security Level in MS Access
Eric McLain 
   
14 months ago
I followed your video's on "User security level parts 1-3 to secure my database.  All is working fine except for in the form "PassLookupF", I have a list box that will not accept the DoCmd.OpenForm "PassLookupF", , , "UserID=" & TempVars("UserID").  (I can still see all user's data in the list box).  The data that is not in the list box is working as it should and the logged in user sees the correct data.

I would post a picture here, but not sure how.  Suggestions on a fix are much appreciated.
Eric McLain OP  @Reply  
   
14 months ago

Adam Schwanz  @Reply  
           
14 months ago
So what is supposed to be happening? You are clicking on the listbox and it is supposed to run that code? Or is that code running somewhere else and then the listbox isn't listing the correct information?
Kevin Robertson  @Reply  
          
14 months ago
Sounds like you may need come criteria in you List Box to limit the items based on UserID.
Eric McLain OP  @Reply  
   
14 months ago
Yes I should only see dada that the logged on user created. In the list box I can see data from all users.  If I click on one of the sites in the list box. I only see data from the logged on user, as It should be.
Eric McLain OP  @Reply  
   
14 months ago
I click on a button to load the form, and it loads correctly, allowing only the logged in user to see his own records in the normal fields.  But in the listbox (where it says, "Select Site Here:", the logged in user can see sites that he did not input.  Should see Site A, but not Site B, C, D.  Therefore, the listbox is not accepting the =TempVars("UserID") in the Forms Default Value Field.  Driving me crazy.  Been trying different things for 3 days.  LOL
Kevin Robertson  @Reply  
          
14 months ago
Did you try editing the Row Source of your List Box?

Example:
   SELECT YourIDField, UserID, FieldOne FROM YourTableName WHERE UserID=TempVars!UserID;

Replace my placeholders with your field names and Table name.
Eric McLain OP  @Reply  
   
14 months ago
Yes tried that, and it blanks out all fields.  And the user is definitely logged on.
Adam Schwanz  @Reply  
           
14 months ago
So it works if you run the code from a button, but not from the "default value" of the field?

If so, run the code in the On Current
Eric McLain OP  @Reply  
   
14 months ago
The code below:

Private Sub PassLookUpBtn_Click()

    DoCmd.OpenForm "PassLookupF", , , "UserID=" & TempVars("UserID")
    DoCmd.Close acForm, Me.Name, acSaveYes
    
End Sub

Opens the Form so that only the currently logged user sees his own data.
In the form on the right side this is working just fine.
In the list box within that form, it is not working.
Adam Schwanz  @Reply  
           
14 months ago
Have you tried adding a button to the form to set (or re-set) the row source of the list box with? To see if something just isn't available yet on form load?
Adam Schwanz  @Reply  
           
14 months ago
Add a button and try like
MyList.RowSource = "SELECT YourIDField, UserID, FieldOne FROM YourTableName WHERE UserID=" & TempVars!UserID
If that works, try running it in the on current event instead of a button.
Eric McLain OP  @Reply  
   
14 months ago
Thank, Adam.  I've tried that, and it did not work.  Is there a way I can upload a copy of the database for someone to look at?
Kevin Robertson  @Reply  
          
14 months ago

Eric McLain OP  @Reply  
   
14 months ago
Adding the "WHERE UserID=TempVars!UserID;" In the row source of the list box, blanks out both the list box and the fields to the right.  Thanks for trying though.  Appreciate it.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 2:42:00 PM. PLT: 0s