Results 1 to 6 of 6
  1. #1
    steve.earle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    3

    Populate list box with query on continous form

    Hi all,


    I am having an issue with populating a list box on my continous form from a query.

    I have the query below:


    Click image for larger version. 

Name:	1.png 
Views:	8 
Size:	39.2 KB 
ID:	17779


    which gives the following results:


    Click image for larger version. 

Name:	2.png 
Views:	8 
Size:	64.8 KB 
ID:	17780


    All OK so far. I have created a continous form from this query which works as I want. I then added a list box to form which is where the problem is arising:

    I have a query called CPs as follows:

    Click image for larger version. 

Name:	3.png 
Views:	8 
Size:	37.5 KB 
ID:	17781


    which returns the following results (which in real life terms tells you who is the competent person for an inspection, of which there could be more than one - inspection 10 for instance):


    Click image for larger version. 

Name:	4.png 
Views:	8 
Size:	34.4 KB 
ID:	17782

    On my form, I have set the row source of the listbox to

    SELECT qryCPs.fldInspectionID, qryCPs.fldPersonnelName FROM qryCPs WHERE (((qryCPs.fldInspectionID)=[Forms]![frmInspections]![fldInspectionID]));

    which should only return the results of the query where the inspectionId matches that displayed on the form.

    What I am getting is as per the screen shot below: The list box values are correct for the first entry (it pulls the names from the query for inspection number 10)

    Click image for larger version. 

Name:	5.png 
Views:	8 
Size:	25.6 KB 
ID:	17783


    however, for inspections 11 and 12 (and all the rest) it is pulling the names for inspection 10.

    Where am I going wrong?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Your WHERE clause is only going to consider one record at a time.
    WHERE (((qryCPs.fldInspectionID)=[Forms]![frmInspections]![fldInspectionID]));

    What ever record you have focus on is the record that is selected and the record that will be considered.

    Perhaps what you want is to create an inner join with your two query objects and use that as the Row Source for your list box. You can use the ellipses next to the Row Source property of your list box to launch the query builder. Add both of your queries and see if the results are closer to what you are after.

  3. #3
    steve.earle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    3
    Quote Originally Posted by ItsMe View Post
    Your WHERE clause is only going to consider one record at a time.
    WHERE (((qryCPs.fldInspectionID)=[Forms]![frmInspections]![fldInspectionID]));

    What ever record you have focus on is the record that is selected and the record that will be considered.

    Perhaps what you want is to create an inner join with your two query objects and use that as the Row Source for your list box. You can use the ellipses next to the Row Source property of your list box to launch the query builder. Add both of your queries and see if the results are closer to what you are after.

    I am unsure how this would help. Wouldn't it take the first record only again because it is relying on info from the form?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    How what would help? I am suggesting that your WHERE clause is at the root of your problem. Get rid of it. Create a new query.

  5. #5
    steve.earle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    3
    Thanks. Getting rid of the where clause now gives every competent person for every inspection, for all records (screenshot attached) which is why I put the where clause there in the first place

    Click image for larger version. 

Name:	6.png 
Views:	4 
Size:	27.1 KB 
ID:	17784

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps what you want is to create an inner join with your two query objects and use that as the Row Source for your list box. You can use the ellipses next to the Row Source property of your list box to launch the query builder. Add both of your queries and see if the results are closer to what you are after.

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

Similar Threads

  1. Sort on Continous Form?
    By NotaryEtc in forum Forms
    Replies: 3
    Last Post: 04-19-2014, 08:35 AM
  2. Replies: 3
    Last Post: 10-10-2013, 08:06 AM
  3. Replies: 10
    Last Post: 10-10-2011, 08:08 PM
  4. Checkbox in continous form
    By senthilrg in forum Access
    Replies: 11
    Last Post: 12-05-2009, 08:49 AM
  5. Horitontal Continous Form?
    By Lawrence in forum Forms
    Replies: 1
    Last Post: 07-21-2009, 03:06 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