Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2015
    Posts
    1

    Unanswered: Filter form when opening

    I'm creating a form for supervisors to enter salary increase recommendations for their staff. I would like the form to be filtered based on supervisor employee ID, which the supervisor should be prompted to enter when opening the form. Is there a simple way to do this? My Access skills are somewhere short of remedial, and based on HR reporting functions only. I'm using 2013, which is also brand new to me (used 2007 previously). However, I think that it is likely the best tool for this project, so any help would be appreciated.
    Last edited by lillielil; 06-19-15 at 11:18. Reason: clarify version (read the FAQ!)

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    496
    Provided Answers: 24
    You COULD do it by userID,
    when the main form opens, capture userID via form.load event

    Code:
    Private Sub Form_Load()
    sUser =  Environ("Username") 
       'then lookup his/her ID
    vSupID = dlookup("[id]", "table","[userID]='" & sUser & "'")
        'then filter the data
    me.Filter = "[supervisorID]=" & vSupID
    me.filteron = true
    end sub

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    don't user environ (or currentuser for that matter) for this sort of thing if you can avoid it. use instead the API call to find the network logon of the user. google dev ashish api
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •