Populate Access ListBox with Distinct/Unique Values

%3CLINGO-SUB%20id%3D%22lingo-sub-1054465%22%20slang%3D%22en-US%22%3EPopulate%20Access%20ListBox%20with%20Distinct%2FUnique%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1054465%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20a%20CS%20student%20in%20my%204th%20year%2C%20my%20professor%20wont%20grade%20my%20assignment%20because%20i%20didn't%20populate%20a%20ListBox%20correctly%20(I%20got%20a%2010%2F200%20but%20i%20have%20an%20option%20to%20turn%20in%201%20revision).%20The%20ListBox%20named%20%22lstCateName%22%20displays%20a%20property%20type%20(castle%2C%20villa%2C%20manor)%20from%20a%20table%20named%20%22tblProperty%22%20on%20a%20form%20called%20%22frmType%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20problem%20is%20with%20getting%20the%20ListBox%20to%20display%20only%20one%20of%20each%20Property%20type%20(Only%203%20options%20instead%20of%20many%20same%20repeating%20options%20like%20in%20the%20image%20below)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20280px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F160572i69C01008A68628F5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221.png%22%20title%3D%221.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20it%20to%20only%20display%203%20options%2C%20%22castle%22%2C%20%22villa%22%2C%20and%20%22manor%22.%20I%20have%20looked%20endlessly%20for%20the%20solution%20to%20no%20avail.%20There%20are%20some%20tutorials%20out%20there%20that%20focus%20on%20Excel%20and%20use%20VBA%20which%20i%20am%20not%20familiar%20with%20nor%20do%20i%20know%20how%20to%20implement%20into%20an%20Access%20Database.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5Bedit%5D%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20what%20i%20currently%20have%20in%20the%20property%20sheet%20for%20the%20ListBox%20under%20the%20Row%20Source%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ESELECT%20DISTINCT%20tblProperty.PropertyID%2C%20tblProperty.PropertyType%20FROM%20tblProperty%20ORDER%20BY%20tblProperty.%5BPropertyType%5D%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThe%20PropertyID%20property%20is%20hidden%20form%20what%20i%20recall.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1054465%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%202016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Elistbox%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1065519%22%20slang%3D%22en-US%22%3ERe%3A%20Populate%20Access%20ListBox%20with%20Distinct%2FUnique%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1065519%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F481519%22%20target%3D%22_blank%22%3E%40globz%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDrop%20the%26nbsp%3B%3CSTRONG%3EtblProperty.PropertyID%3C%2FSTRONG%3E%20field%20so%20it%20looks%20like%20this%3A%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000080%22%3ESELECT%20DISTINCT%20tblProperty.PropertyType%20FROM%20tblProperty%20ORDER%20BY%20tblProperty.%5BPropertyType%5D%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

I'm a CS student in my 4th year, my professor wont grade my assignment because i didn't populate a ListBox correctly (I got a 10/200 but i have an option to turn in 1 revision). The ListBox named "lstCateName" displays a property type (castle, villa, manor) from a table named "tblProperty" on a form called "frmType".

 

My problem is with getting the ListBox to display only one of each Property type (Only 3 options instead of many same repeating options like in the image below)

 

1.png

 

I need it to only display 3 options, "castle", "villa", and "manor". I have looked endlessly for the solution to no avail. There are some tutorials out there that focus on Excel and use VBA which i am not familiar with nor do i know how to implement into an Access Database.

 

[edit]

This is what i currently have in the property sheet for the ListBox under the Row Source

SELECT DISTINCT tblProperty.PropertyID, tblProperty.PropertyType FROM tblProperty ORDER BY tblProperty.[PropertyType];

The PropertyID property is hidden form what i recall.

 

1 Reply
Highlighted

@globz 

 

Drop the tblProperty.PropertyID field so it looks like this:

SELECT DISTINCT tblProperty.PropertyType FROM tblProperty ORDER BY tblProperty.[PropertyType];