Populate Access ListBox with Distinct/Unique Values

globz

New Member
Joined
Dec 8, 2019
Messages
1
Office Version
365
Platform
Windows
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.
 
Last edited by a moderator:

hernantorres23

Active Member
Joined
Nov 21, 2019
Messages
256
Office Version
365, 2016
Platform
Windows, Web
Hi, in Access is easier than Excel, you only use RowSourceType property to Table/Query and its RowSource property put the query with Select Distinct Type From tblProperty

Please see this post:
 

Forum statistics

Threads
1,081,677
Messages
5,360,451
Members
400,586
Latest member
Minty

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top