Results 1 to 10 of 10
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365

    Combo Biox question

    In an unbound Combo box can the default item be the first item in the list ?
    I'm trying
    Code:
     For i = 1 To UBound(Files)
        Form_frmtest.cboA.AddItem Files(i)
     Next
    Form_frmtest.cboA.DefaultValue = files(1)
    But the last instruction is ignored.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    I just tested with combobox that uses query for source. Setting DefaultValue to first item ID works, item is selected.
    But why bother with DefaultValue - just set value of combobox.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,655
    try
    Code:
    Form_frmtest.cboA.DefaultValue = Form_frmtest.cboA.ItemData(0)
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    June Unfortunately that had no effect. There's nothing in the combo box until the dropdown is clicked.
    Can this work, or is it a lost cause. In which case I can try writing the data to a table and use a query as row source.

  5. #5
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    Likewise moke, no change. I can see ItemData(0) though.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    I revised my previous answer, perhaps after you first read.

    Initial test with UNBOUND combobox with ValueList exhibits same results you encountered.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    Thanks June , that is working great - but now I see another problem. If the text doesn't fit it is truncated.
    Can it wordwrap? Or failing that, can I know it will? Then I can work out some way to deal with it.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Truncated in dropdown list? Will not wrap.

    Will wrap in the text box part if you increase height.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    What I'm displaying varies and can be any length.
    All that I'll know is the number of characters. But the space they need varies because of the proportional spacing.
    What do people do to resolve this?

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,811
    But the space they need varies because of the proportional spacing.
    What do people do to resolve this?
    Use a fixed width font?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo Box Question
    By buck in forum Access
    Replies: 11
    Last Post: 01-20-2014, 10:14 AM
  2. Replies: 4
    Last Post: 08-25-2012, 07:19 PM
  3. combo box question
    By RedGoneWILD in forum Forms
    Replies: 2
    Last Post: 06-28-2012, 03:37 PM
  4. Question-Combo-Box
    By rockrider in forum Forms
    Replies: 1
    Last Post: 02-16-2011, 06:24 PM
  5. Combo box question
    By nkenney in forum Forms
    Replies: 1
    Last Post: 07-09-2009, 08:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums