Ask Your Question
0

List Box results from another list box

asked 2017-10-07 16:21:45 +0200

MaaX gravatar image

Hi, on my form i have a CUSTOMER list box which lists all the customers already in the database. I have another list box that is called SIMILAR TOO. I want the SIMILAR TOO list box to only list items that are associated with the CUSTOMER i have already picked in the form. Currently my SIMILAR TOO list box simply lists all of the item in the database. How can i restrict the list to only show if they are associated with same CUSTOMER?

many thanks Max

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-10-07 19:06:15 +0200

Ratslinger gravatar image

Hello,

Your question lacks many details to be able to give an answer specific to the results you want but the attached sample should give you a starting point to proceed.

The sample deals with people in companies and their position. On the single form, The Select Person list box allows selection of an item in the People table. Then, using the button and based upon the selected item, the table control displays the record AND the second list box now contains all People who have the same position in any company. Because of the selection method, the second list box also contains the person in the first list box.

So the second list box is based upon a query which is based upon the selected item of the first list box.

Sample: PeopleSameCriteria.odb

edit flag offensive delete link more

Comments

Many thanks, i think this will work for me.

MaaX gravatar imageMaaX ( 2017-10-08 11:33:33 +0200 )edit

OK, so i played with this for hours now and still no further forward. When looking at how the SelectionCriteria query was made I came across an error which would only let me open the query in SQL view. There is mention of CRITERIA but i am unable to see to what this relates. Any further advice?

MaaX gravatar imageMaaX ( 2017-10-09 17:10:24 +0200 )edit

This is simply SQL. Because of the construction of the statement, LO doesn't accommodate this in the IDE view so it must be opened in the SQL view (my preferred method anyway). CRITERIA is just a renaming of the Position field to give it a unique name for comparison purposes.

So, for your situation, you must create an SQL statement based upon your requirements of SIMILAR TOO. This is something you never expressed in your question - what exactly this means.

Ratslinger gravatar imageRatslinger ( 2017-10-09 17:34:09 +0200 )edit

Hi, yes i tried to keep my original question as brief as possible in the hope some kind soul would point me in the right direction. you of course did this and I fear the information you gave me should have been enough for me to work with but my ageing brain wasnt quit eable to get there. I have managed similar scenarios in MS Access years ago but have to admit I am struggling with LO. Hmm i tried to expand and elaborate on my original question but ran out of characters. I will post again. thanks

MaaX gravatar imageMaaX ( 2017-10-10 09:19:03 +0200 )edit

@MaaX The question here is " What makes the items in the second list box SIMILAR TOO the items in the first list box?" This is where SQL then comes in (even in Access and most other DB's).

Ratslinger gravatar imageRatslinger ( 2017-10-10 15:14:33 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-10-07 16:21:45 +0200

Seen: 60 times

Last updated: Oct 07 '17