enter image description hereI am having trouble populating my listbox, like, I want to populate it WHERE active = "1" so that data with active = "1" are shown and data with active="0" are still hidden,
This list shows the catname "hey now" and "shiet" which they have the active = "0":
I want them to only display on my listbox the ones with active = 1
You can do this easily with a RowSourceType of 3 (SQL) and supplying the SQL needed. And you can do it either in the designer or in code, whichever you like. In design window, you use PEM sheet (Properties-Events-Methods window) to do this, not the builder (unfortunately builder doesn't have SQL option):
Set RowSourceType to 3 (SQL statement)
Set RowSource to:
select CatName, CategoryId from tbl_Category where Active="1" into cursor crsMyList
That is all. When you run your form it would list the Category Names where Active="1" only (BTW if Active field is numeric then remove quotes).
And you get selected row's values simply using the crsMyList alias like:
selectedCategoryId = crsMyList.CategoryId
selectedCategoryName = crsMyList.CatName