Results 1 to 8 of 8
  1. #1
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22

    Newbie - List box of all related records


    I have created a 'documents' table with 4 simple fields;
    Reference, Filepath, Filetype, Date

    The reference field relates to my supplier database which has one record per reference. It will be a one to many relationship with multiple records in the documents table for each reference.

    I would like a list box on my main form with all the records in the documents table that have the same reference as the record being displayed.

    I created a query like this;

    Click image for larger version. 

Name:	Capture.JPG 
Views:	11 
Size:	51.6 KB 
ID:	13520

    how do I get the list box to only display the records that correspond? Do I put the criteria in the query or use something like a DLookup to extract the records?

    regards
    Simon

  2. #2
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    if you're asking how to change what appears in a combo box depending on the form then make a combo box, go into properties, data, row source, click the 3 little dots, and add criteria along the lines of like Forms!... Or you can make a query and link the combo box to the query. Make sure to add a Refresh somewhere so that it updates.

  3. #3
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22
    I'm sorry, but I'm still struggling with this and I realise it should be really easy.
    I created a list box and then populated it with the following query

    Click image for larger version. 

Name:	snip1.JPG 
Views:	5 
Size:	68.6 KB 
ID:	13604
    but it displays the first record in the supp_linked table on all records.

    Click image for larger version. 

Name:	snip2.JPG 
Views:	5 
Size:	53.0 KB 
ID:	13605

    any pointers much appreciated

    regards
    Simon

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    You need to requery the listbox whenever you move from current record. In the commnad button's code which move to Next and Previous record, you need to put a line of code
    Code:
    Me.YourListBoxName.Requery
    I would suggest you to use a sub form instead of list box which will automatically display related records. Create a new form based on the query and drag it to this form. Link the master and child fields.

  5. #5
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22
    Amrut, you are a star. The requery works fine - I'll take a look at using a subform when I have more time. Thanks

  6. #6
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Glad to help
    Please mark thread as solved.

  7. #7
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22
    I would love to - how do I do that ?

  8. #8
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Thread Tools up top on bar, Mark as Solved.

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

Similar Threads

  1. Subform related to list
    By rumenrs in forum Forms
    Replies: 3
    Last Post: 08-02-2013, 10:15 AM
  2. How to store ID on list box but show related data
    By Clarionchanger in forum Access
    Replies: 3
    Last Post: 10-11-2012, 03:31 PM
  3. Replies: 10
    Last Post: 10-10-2012, 11:15 PM
  4. query won't display records with no related records
    By James Brazill in forum Queries
    Replies: 1
    Last Post: 06-28-2011, 02:10 AM
  5. Replies: 3
    Last Post: 03-25-2010, 12:31 PM

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