• Combo Box Format (2000)

    • This topic has 5 replies, 3 voices, and was last updated 22 years ago.
    Author
    Topic
    #386759

    I have a combo box showing seven columns (2 text and 5 numeric). This has worked just fine with the numeric values displayed to the second decimal point. I now need to have the numeric values displayed to the fourth decimal. No biggie (or, so I thought). I went to the underlying table upon which the query is built and changed the ‘Decimal Places’ setting from 2 to 4, ran the query, and viewed the results. Beautiful! Datasheet view reveals the change from 2 to 4 decimal points. The combo (built on that query), however, does not display the change; I’m still only getting 2 decimal points. I’ve searched help and our site here, but can’t seem to locate the appropriate reference.

    As always, any input and/or direction greatly appreciated.

    Viewing 2 reply threads
    Author
    Replies
    • #672431

      I don’t know why this happens, but you can get around it by using the Format function in the query:

      F:Format([MyField],”0.0000″)

      instead of just MyField.

      • #672442

        Amazing. I don’t know how you come up with these answers off the top of your head, but I sure appreciate it. I did notice that I had a circular reference issue when using the same name as the existing “F”, no big deal, I just renamed it (as well as the SQL for the combo). Thanks a bunch Hans, and thank you Charlotte for the expansion!

    • #672432

      Changing the decimals in the table or query simply means you display the number of decimal places specified in the table or query. It may carry over to a new control placed on a form, but it has nothing to do with what happens in the combobox. A row in a combobox is essentially a string so any formatting you want aside from defaults has to be done using the format function as Hans has suggested.

    • #672444

      Alternatively, you can set the Format property to a custom format with 4 decimals, like 0.0000 or if you want thousands separators too, #,##0.0000

      The Format property is used in the combo box, but the Decimal Places property is ignored.

      • #672448

        I had done that with some other combo’s, but they were numeric only. As I have two text columns in this combo also, I thought it might cause some problems and discounted it without further consideration. At any rate, your original solution works great. I will, however, try the later solution later to see what effect it has on the text/numeric display and post back here with the results. Thanks again!

    Viewing 2 reply threads
    Reply To: Combo Box Format (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: