Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    showing actual data rather then ID key (2000)

    <P ID="edit" class=small>(Edited by charlotte on 16-Jun-03 06:09. to activate link to post)</P>Hello this relates closely to <post#=261215>post 261215</post#>. The code I use as from the post is
    txtColorList = (txtColorList + ", ") & cboColorDescription

    This works fine but the data that has transferred to the text box shows the primary key number rather then the actual text. The combo is a lookup from a table.

    How can I get my text box to show the text that is clicked from the combo rather than the ID number?

    Thanks Darren.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: showing actual data rather then ID key (2000)

    Sorry, but I don't understand why you're populating a textbox at all if you already made a combobox selection, unless the combobox is unbound. In any case, if you want to store the description, you need to refer to the column of the combobox that holds the text. Column numbering is zero based, so if the text is in the second column you would do it like this:

    txtColorList = (txtColorList + ", ") & cboColorDescription.Column(1)
    Charlotte

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: showing actual data rather then ID key (2000)

    Check your combo, how many columns does it have.
    Combo's columns start from the first one being (0) then (1) etc.

    You may have to refer to the text you require with the following:

    txtColorList = (txtColorList + ", ") & cboColorDescription.Column(1)

    The above will refer to the 2nd column in you Combo, adjust the "(?)" bit to suit your needs.

  4. #4
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: showing actual data rather then ID key (2000)

    Thanks guys, does the trick. Just to explain my apparent madness Charlotte, perhaps this isn't the most efficient way but my boss wants to be able to have multiple entries in the text box derived from the choices in the the combo (I just do as I am told!!).

    Regards Darren.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: showing actual data rather then ID key (2000)

    I see where you're coming from on this and it's great for data you won't need to filter later.

    If you do, filtering could well be difficult to pull certain text values without using complicated VBA routines.
    Just for example, I would use this method for a vehicles attributes:

    Vauxhall, Vectra, CDi, Blue, Air Con, Painted mirrors,

    But it could be difficult to query all the blue cars in my database, due to the multiple entries and inconsistent data in the one field.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: showing actual data rather then ID key (2000)

    Your boss is asking you to do something BAD, and it will bite you both sooner rather than later! It violates every principle of normalization to stuff multiple values into a field, because there is now no way to get to a record with any particular value in it without jumping through a bunch of hoops, and the first time you try to find all the records that have x and y but not z in that field, you'll discover some of the reasons its a very bad idea. The proper way to do it is with a separate table that holds a foreign key relating it to the other table but contains one record for each of those values your boss wants to stuff into a single field. You can display all of them on a subform on your form and then you can filter or query out records that have only particular values or particular combinations of values in that field without any difficulty. If you show the boss a better mousetrap, he may be willing to us it. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

Posting Permissions

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