Results 1 to 2 of 2
  1. #1
    nancypez is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    2

    Applying filter with selected field based on another field

    I have a login screen to open a form. I would like to filter the form based on what user logs in.


    In my tbluser, I have a trainer name, a UserLogin, and a password. I would like the form to filter on trainer name based on userlogin.

    I know the code: DoCmd.ApplyFilter , "Trainer = 'Joe Smith'" but how to I edit the code to change as the tbluser changes?

    Any assistance with this would be greatly appreciated. I am new to coding and am enjoying learning as I go but still seem to get stuck at spots.

    Thank you.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by nancypez View Post
    ...how to I edit the code to change as the tbluser changes?...
    You don't edit the code. Are you familiar with Primary Keys? Your tables should have relationships with other tables. Use the relationships and query the relative data you want to retrieve.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 12-29-2013, 11:21 AM
  2. Filter Contacts based on Selected Customer
    By davecumber in forum Forms
    Replies: 7
    Last Post: 07-25-2013, 06:17 AM
  3. Replies: 14
    Last Post: 12-06-2012, 11:25 AM
  4. Replies: 6
    Last Post: 10-28-2012, 02:33 PM
  5. Replies: 3
    Last Post: 11-29-2011, 12:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums