Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004

    Unanswered: Count Combo Box Values

    I have a form containing 4 combo boxes. One combo box limits its values depending on the values selected in the other three combo boxes. What I want is to have a text box that displays the current number of values listed in that 1 main combo box. How is this done?

  2. #2
    Join Date
    Jul 2004
    Blackburn, UK


    I think this would be somewhere along the line of

    Dim Totvalue as integer
    TotValue = DCount("[ComboBoxBoundField]", "Tbl to extract info from", "[TblField]=ComboBox")
    Textbox = TotValue
    That should do a count and filter out only the values that are in the combo box

    I would apply this to the after update on the combo box
    Last edited by ChrisGolden; 10-03-04 at 16:26. Reason: Error in the code

  3. #3
    Join Date
    Jan 2004
    I tried modifying this code but the only number I could get is 1, or 817 (the total number of records available) if I removed the =combobox reference, no matter what filters have been applied. The modified code I used is:

    Dim ComboCount as integer
    ComboCount = DCount("[StuRecID]", "BaseData_qry", "[StuRecID]=Combo2")
    Text71 = ComboCount

    Can you see anything obviously wrong with this code.


  4. #4
    Join Date
    Apr 2004
    outside the rim
    Try using the ListCount property.

    In the Control Source property of another textbox, use something along the lines of:
    In code, it would be:
        Dim intcount As Integer
        intCount = Me.YourComboField.ListCount
        Me.YourTextField = intCount
    Have fun!
    have fun!

    Todd S.
    click to email

    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET

    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

Posting Permissions

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