Results 1 to 7 of 7
  1. #1
    jinro is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    12

    (SOLVED) Need help on Filtering listbox


    Hi there,
    What I have is a form where you can add attachments.
    What I want to do is add a listbox that displays the names of the attached attachments by Record.
    So if record 1 has 0 attachments the listbox will show no names
    If record 2 has 3 attachments then the listbox will display the names of those 3 attachments.
    Right now my Unbound listbox that uses a query that has the attachment name and id and unuiqe ID (so it can have same type of ID Sample001, sample 001 on each attachment) shows the names of ALL attached attachments no matter what record I am on.
    Any help would be really appreciated as this is the last thing holding my project to go live, i have been fighting with it for days now.
    Thanks in advance for your time and help.
    Attached is an example database
    Attached Files Attached Files
    Last edited by jinro; 08-22-2014 at 10:41 PM. Reason: Solved

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    You have to requery the listbox each time you move from current record. Modify the listbox row source to include the ID field matching the one on form
    Code:
    SELECT test.test.FileName, test.ID FROM test WHERE (((test.ID)=[Forms]![test]![ID]));
    and in the form's current event, requery the listbox.

  3. #3
    jinro is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    12
    BTW its on a subform where the main form and subform is displaying the custom ID at the same time (dont know if that will help at all) been trying all types of things like if id on main page = then listbox = but cant get anything to work.
    Can any one lead me in a direction or another way of displaying the info I am trying?

  4. #4
    jinro is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    12
    posted same time as i posted the below, trying now

  5. #5
    jinro is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    12
    i should of used better naming conventions instead of test for mutiple. Could you please break the code down for me?
    SELECT test.test.FileName, test.ID FROM test WHERE (((test.ID)=[Forms]![test]![ID]));
    as in which test refers to which. I should of named testform testattach and so on so i could read better sorry, but thank you if you will do that for me.

  6. #6
    jinro is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    12
    NM, i figured it out just had to try it acouple of times. Thank you so much! worked

  7. #7
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    SELECT test(1).test(2).FileName, test(3).ID FROM test(4) WHERE (((test.ID)=[Forms]![test(5)]![ID]));
    Here are all your "tests"
    1.Table test
    2.attachment field "test"
    3.ID field in table test
    4. Table test
    5.Form named test
    There is only one form by the name "test" in db you posted and it has a list box named "List8". Change List8 row source as I have shown and requery in current event.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-23-2014, 06:50 AM
  2. Replies: 15
    Last Post: 10-01-2013, 09:31 PM
  3. Replies: 3
    Last Post: 12-13-2012, 04:40 AM
  4. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  5. Replies: 1
    Last Post: 07-26-2012, 11:45 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