Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140

    Unanswered: ComboBox Listcount returns incorrect value?

    Morning all,

    I've got a bunch of comboboxes scattered throughout this db I'm developing, they all are populated using an SQL statement and the .RowSource property within VBA. A great many of them are checked using:
    Code:
    if cbo_Blah.ListCount = 0 then
           do some code
    end if
    and they all work flawlessly....until I built one this morning. I've got one combobox that insists its .listcount = 1 when it returns a empty list (ran the SQL thru Query Builder to verify). I don't have column headers turned on, just my standard combobox properties...nothing which should create its own index.

    The SQL statement behind the box is this:
    Code:
    
    cbo_Manuf.RowSource = "SELECT DISTINCT tbl_Item_Manufacturer.Manufacturer_ID, " _
            & "tbl_Item_Manufacturer.Manufacturer_Name" _
            & "FROM tbl_Item_Manufacturer INNER JOIN tbl_Item_Manufacturer_Model ON " _
            & "tbl_Item_Manufacturer.Manufacturer_ID = tbl_Item_Manufacturer_Model" _
            & ".Manufacturer_ID ORDER BY tbl_Item_Manufacturer.Manufacturer_Name;"
    Any ideas why this would return a listcount property of 1 instead of 0 like it should? The Model_Number table isn't populated with test data yet, so no manufacturer has any child model numbers at this point.

    Thanks,

    Sam, Bah! I hate Mondays.
    Good, fast, cheap...Pick 2.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Could you try testing what it thinks is there with a msgbox output or something? See what it thinks is there?
    Me.Geek = True

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Check the column heads property. It may be that if that is yes, it counts the header as a row.
    Paul

  4. #4
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140
    Column heads are off, msgbox is null. While I still don't know why the heck it decided to do what it did, I reworded my SQL statement and came at it from a different angle...and now it works like it should...listcount = 0 and counts correctly with test data in the table. Bizarre, but, such is life on Mondays.

    Sam, thanks for the responses.
    Good, fast, cheap...Pick 2.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •