Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205

    Unanswered: Quotes and comma's in Combo boxes

    Guys,

    I am trying to populate a combo box (value list) with a string like the following:

    P5674-31 5", in black w/75W PAR 30

    The trick is I need it all to show as one row and not as two or three because of the comma's and quotes. Anyone have some ideas?
    Last edited by TerpInMD; 07-07-06 at 00:09.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Can't happen. Switch it to a table ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Or you can escape the quote:

    Row Source: "P5674-31 5"", in black w/75W PAR 30"
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    By using a table I defeat the purpose of what I was trying to do; use unbound forms and controls to improve performance.

    Pootle, that didnt work.

    I am going to propose that they use:

    " = inch
    ' = ft

    Then I can handle the comma's withing quotes. By the way I found that ADO supports a GetString method for recordsets. Esentially what I did was create a getstring method within DAO. I guess its time I think about making the switch.

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by TerpInMD
    By using a table I defeat the purpose of what I was trying to do; use unbound forms and controls to improve performance.

    Pootle, that didnt work.

    I am going to propose that they use:

    " = inch
    ' = ft

    Then I can handle the comma's withing quotes. By the way I found that ADO supports a GetString method for recordsets. Esentially what I did was create a getstring method within DAO. I guess its time I think about making the switch.
    Nooooo ... You still can. You don't HAVE to bind the control to the table at design time ... Another thing to consider (generally, not necessarily apllies to you) is that a Value List imposes a hard limit of 2048 characters available for selection in a combobox. This includes the token delimiters ... Also, a reason why I went away from Value Lists myself ... All of my comboboxes are unbound BUT are sourced to a temp table that I load on the fly ...
    Back to Access ... ADO is not the way to go for speed ...

  6. #6
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    I thought about doing that as well, which I have done before. I was not aware of the character limit. It sounds like value list is pretty much useless.

    I was trying to avoid loading and unloading data from tables right and left but I suppose I will have to consider it for at least some of these lookups.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Yep - I don't like value lists much either. BTW - another unbound option is to populate a recordset and set the combo boxes recordset = to this recordset. I have used this for personal dbs but not, now I come to think of it, in any production stuff.
    Examples here (bottom third or so of the page):
    http://msdn.microsoft.com/library/de...tml/sa01l8.asp
    Quote Originally Posted by TerpInMD
    Pootle, that didnt work.
    Out of curiosity - how does this not work? Worked great for me in tests. Did you include the quotes "around the text"?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Not that one is stubborn or anything....
    Attached Files Attached Files
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Quote Originally Posted by pootle flump
    Not that one is stubborn or anything....



    Thanks I see what you mean now.

    I am def going to check out setting a combo list recordsource = to the recordset. I imagine that would work for forms as well? That could open up a whole new way of doing things.

    I really hate managing local tables. If the value list wasnt limited to 2000 characters I would do that. Instead I am going to try the RST way.

    Now that wouldnt bind the control to the backend tables would it? You could open the recordset, set your control to it, then close the recordset?

  10. #10
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    I thought the 2048 character limit of value list rowsource of combos and lists where for the 2000, and older versions, and that 2002, and later versions had a limit of 32 750 characters+

    Also, using a callback function, would circumvent such limits.
    Roy-Vidar

  11. #11
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Quote Originally Posted by RoyVidar
    I thought the 2048 character limit of value list rowsource of combos and lists where for the 2000, and older versions, and that 2002, and later versions had a limit of 32 750 characters+

    Also, using a callback function, would circumvent such limits.






    Please explain with an example. Sounds interesting.

  12. #12
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    Example of what?
    Code:
        Dim a                   As String
        Dim l                   As Long
        
        For l = 1 To 100
            a = String(32740 + l, "a")
            Debug.Print l, Len(Me!lstTest.RowSource)
            Me!lstTest.RowSource = a
        Next l
    or http://www.mvps.org/access/forms/frm0049.htm
    Roy-Vidar

  13. #13
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    Found a couple more samples of callback function
    http://groups.google.com/group/micro...4b8b8c0031996/
    http://www.allenbrowne.com/func-02.html
    Another sample can be found in the help files. I think, if you enter the help topic for RowSourceType, there should be a link to specific function code arguments, which might be helpful.

    Though, though, I don't know how this works with regards to the quote and comma thingie.
    Roy-Vidar

  14. #14
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by TerpInMD
    I am def going to check out setting a combo list recordsource = to the recordset. I imagine that would work for forms as well?
    Yes. ADO only I think. Works great for read only. Much more difficult if you want to, for example, add items to the list especially (as I recall) if you use surrogate keys. Sadly you can't set a recordset as a report recordsource. I presume this is because a recordset is just a cursor and a report acts on sets but I don't really know.

    Hmmm - callback. Looks like I've some reading to do
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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