Combobox value is wrong

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronny Sigo

    #1

    Combobox value is wrong

    Hello all,
    On my form I have an unbound combobox based on a query displaying two rows.
    The rows are : 1) Zipcode (Leftmost (In the query this field is sorted
    ascending
    2 City

    The BoundColumn property is set to 2, because the value of Citymust appear
    in another control
    When selecting a unique zipcode there is no problem, it does what is
    expected but ...

    Now lets' say that I have displayed :

    2030 Zottegem
    2040 Antwerpen
    2040 Berendrecht
    2040 Lillo

    When clicking on any 2040 value it will always give Antwerpen as its value,
    obviously the first in the alabetic order. What is it that I am doing wrong
    ?
    Any help appreciated ... thanks
    Ronny




  • Wayne Morgan

    #2
    Re: Combobox value is wrong

    You don't need to bind the 2nd column to get its value to appear in another control. It is
    true that the value of the combo box is based on the bound column, but you can get the
    value from any column using the .Column property instead of the .Value property. So, if
    you bind to the first column and want the value of the 2nd displayed in a textbox you
    could use something like

    =Me.cboMyCombob ox.Column(1)

    Yes, use 1 to get the value from the 2nd column. The index is zero based.

    --
    Wayne Morgan


    "Ronny Sigo" <ronny.sigo@sky net.be> wrote in message
    news:3f79e562$0 $10714$ba620e4c @reader2.news.s kynet.be...[color=blue]
    > Hello all,
    > On my form I have an unbound combobox based on a query displaying two rows.
    > The rows are : 1) Zipcode (Leftmost (In the query this field is sorted
    > ascending
    > 2 City
    >
    > The BoundColumn property is set to 2, because the value of Citymust appear
    > in another control
    > When selecting a unique zipcode there is no problem, it does what is
    > expected but ...
    >
    > Now lets' say that I have displayed :
    >
    > 2030 Zottegem
    > 2040 Antwerpen
    > 2040 Berendrecht
    > 2040 Lillo
    >
    > When clicking on any 2040 value it will always give Antwerpen as its value,
    > obviously the first in the alabetic order. What is it that I am doing wrong
    > ?
    > Any help appreciated ... thanks
    > Ronny
    >
    >
    >
    >[/color]


    Comment

    • Bruce M. Thompson

      #3
      Re: Combobox value is wrong

      > Now lets' say that I have displayed :[color=blue]
      >
      > 2030 Zottegem
      > 2040 Antwerpen
      > 2040 Berendrecht
      > 2040 Lillo
      >
      > When clicking on any 2040 value it will always give Antwerpen as its value,
      > obviously the first in the alabetic order. What is it that I am doing wrong[/color]

      The combo box is behaving normally. When a value is selected, it will always
      fall back to the first instance of the bound column's value. It would appear
      that you must either create a unique record identifier for each entry (bound
      column - the value you would store) in the list, or you must store the city in
      another field (the zip code control could be a typed-in value in a textbox or a
      combo box listing distinct zipcodes and the city combo could display a filtered
      list of cities, filtered on that zipcode field's value).

      --
      Bruce M. Thompson
      bthmpson@mvps.o rg (See the Access FAQ at http://www.mvps.org/access)[color=blue][color=green]
      >> NO Email Please. Keep all communications[/color][/color]
      within the newsgroups so that all might benefit.<<


      Comment

      • Ronny Sigo

        #4
        Re: Combobox value is wrong

        Thanks guys !
        "Wayne Morgan" <comprev_gothro ughthenewsgroup @hotmail.com> schreef in
        bericht news:GIleb.8884 $IV1.2750@newss vr32.news.prodi gy.com...[color=blue]
        > You don't need to bind the 2nd column to get its value to appear in[/color]
        another control. It is[color=blue]
        > true that the value of the combo box is based on the bound column, but you[/color]
        can get the[color=blue]
        > value from any column using the .Column property instead of the .Value[/color]
        property. So, if[color=blue]
        > you bind to the first column and want the value of the 2nd displayed in a[/color]
        textbox you[color=blue]
        > could use something like
        >
        > =Me.cboMyCombob ox.Column(1)
        >
        > Yes, use 1 to get the value from the 2nd column. The index is zero based.
        >
        > --
        > Wayne Morgan
        >
        >
        > "Ronny Sigo" <ronny.sigo@sky net.be> wrote in message
        > news:3f79e562$0 $10714$ba620e4c @reader2.news.s kynet.be...[color=green]
        > > Hello all,
        > > On my form I have an unbound combobox based on a query displaying two[/color][/color]
        rows.[color=blue][color=green]
        > > The rows are : 1) Zipcode (Leftmost (In the query this field is[/color][/color]
        sorted[color=blue][color=green]
        > > ascending
        > > 2 City
        > >
        > > The BoundColumn property is set to 2, because the value of Citymust[/color][/color]
        appear[color=blue][color=green]
        > > in another control
        > > When selecting a unique zipcode there is no problem, it does what is
        > > expected but ...
        > >
        > > Now lets' say that I have displayed :
        > >
        > > 2030 Zottegem
        > > 2040 Antwerpen
        > > 2040 Berendrecht
        > > 2040 Lillo
        > >
        > > When clicking on any 2040 value it will always give Antwerpen as its[/color][/color]
        value,[color=blue][color=green]
        > > obviously the first in the alabetic order. What is it that I am doing[/color][/color]
        wrong[color=blue][color=green]
        > > ?
        > > Any help appreciated ... thanks
        > > Ronny
        > >
        > >
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...