List box column,row as control source

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lou O

    #1

    List box column,row as control source

    Is it possible to use the row (index) of a list box as control source
    Property for a text box?
    Example: Text1.ControlSo urce Property is set to "= List1.Column(0, 2)"
    in design view.
    When I open the form, Text1 does not display the value of
    List1.Column(0, 2)
    Am I missing something?
  • tina

    #2
    Re: List box column,row as control source

    when you set the control source of an unbound textbox to "=" another
    control, you're setting it to the *value* in that control. a listbox
    control's value is equal to the bound column of the selected record in the
    listbox control's RowSource. the value of other columns can be referred to,
    but only for the *selected* row. i think you're going to have to select row
    2 in the listbox, then you can display the value of column 0 from that row,
    in your textbox control.

    hth


    "Lou O" <lgeastwood@gma il.comwrote in message
    news:4b0dfe17-cca6-428b-9e08-ecccb90b0e8d@p2 5g2000hsf.googl egroups.com...
    Is it possible to use the row (index) of a list box as control source
    Property for a text box?
    Example: Text1.ControlSo urce Property is set to "= List1.Column(0, 2)"
    in design view.
    When I open the form, Text1 does not display the value of
    List1.Column(0, 2)
    Am I missing something?

    Comment

    • Lou O

      #3
      Re: List box column,row as control source

      On Aug 19, 10:28 pm, "tina" <nos...@address .comwrote:
      when you set the control source of an unbound textbox to "=" another
      control, you're setting it to the *value* in that control. a listbox
      control's value is equal to the bound column of the selected record in the
      listbox control's RowSource. the value of other columns can be referred to,
      but only for the *selected* row. i think you're going to have to select row
      2 in the listbox, then you can display the value of column 0 from that row,
      in your textbox control.
      >
      hth
      >
      "Lou O" <lgeastw...@gma il.comwrote in message
      >
      news:4b0dfe17-cca6-428b-9e08-ecccb90b0e8d@p2 5g2000hsf.googl egroups.com...
      >
      Is it possible to use the row (index) of a list box as control source
      Property for a text box?
      Example: Text1.ControlSo urce Property is set to "= List1.Column(0, 2)"
      in design view.
      When I open the form, Text1 does not display the value of
      List1.Column(0, 2)
      Am I missing something?
      I discovered something interesting by chance. If I reverse the
      (column,row) to (row/column) of the listbox, I can set the
      ControlSource of any textbox on the form to display the data of the
      specified row & column. Cool; just what I wanted. I wonder though if
      this is standard or just a fluke that is not supported by MS. If I
      build my form on this premiss, am I going to have trouble down the
      road?

      Comment

      • tina

        #4
        Re: List box column,row as control source

        i don't know. how did you reverse it?


        "Lou O" <lgeastwood@gma il.comwrote in message
        news:18c6d2a3-0cd3-42b3-bb29-a4107d39de41@d7 7g2000hsb.googl egroups.com...
        On Aug 19, 10:28 pm, "tina" <nos...@address .comwrote:
        when you set the control source of an unbound textbox to "=" another
        control, you're setting it to the *value* in that control. a listbox
        control's value is equal to the bound column of the selected record in the
        listbox control's RowSource. the value of other columns can be referred
        to,
        but only for the *selected* row. i think you're going to have to select
        row
        2 in the listbox, then you can display the value of column 0 from that
        row,
        in your textbox control.
        >
        hth
        >
        "Lou O" <lgeastw...@gma il.comwrote in message
        >
        news:4b0dfe17-cca6-428b-9e08-ecccb90b0e8d@p2 5g2000hsf.googl egroups.com...
        >
        Is it possible to use the row (index) of a list box as control source
        Property for a text box?
        Example: Text1.ControlSo urce Property is set to "= List1.Column(0, 2)"
        in design view.
        When I open the form, Text1 does not display the value of
        List1.Column(0, 2)
        Am I missing something?
        I discovered something interesting by chance. If I reverse the
        (column,row) to (row/column) of the listbox, I can set the
        ControlSource of any textbox on the form to display the data of the
        specified row & column. Cool; just what I wanted. I wonder though if
        this is standard or just a fluke that is not supported by MS. If I
        build my form on this premiss, am I going to have trouble down the
        road?


        Comment

        • Lou O

          #5
          Re: List box column,row as control source

          On Aug 23, 10:19 am, "tina" <nos...@address .comwrote:
          i don't know. how did you reverse it?
          >
          "Lou O" <lgeastw...@gma il.comwrote in message
          >
          news:18c6d2a3-0cd3-42b3-bb29-a4107d39de41@d7 7g2000hsb.googl egroups.com...
          On Aug 19, 10:28 pm, "tina" <nos...@address .comwrote:
          >
          >
          >
          when you set the control source of an unbound textbox to "=" another
          control, you're setting it to the *value* in that control. a listbox
          control's value is equal to the bound column of the selected record in the
          listbox control's RowSource. the value of other columns can be referred
          to,
          but only for the *selected* row. i think you're going to have to select
          row
          2 in the listbox, then you can display the value of column 0 from that
          row,
          in your textbox control.
          >
          hth
          >
          "Lou O" <lgeastw...@gma il.comwrote in message
          >
          news:4b0dfe17-cca6-428b-9e08-ecccb90b0e8d@p2 5g2000hsf.googl egroups.com....
          >
          Is it possible to use the row (index) of a list box as control source
          Property for a text box?
          Example: Text1.ControlSo urce Property is set to "= List1.Column(0, 2)"
          in design view.
          When I open the form, Text1 does not display the value of
          List1.Column(0, 2)
          Am I missing something?
          >
          I discovered something interesting by chance. If I reverse the
          (column,row) to (row/column) of the listbox, I can set the
          ControlSource of any textbox on the form to display the data of the
          specified row & column. Cool; just what I wanted. I wonder though if
          this is standard or just a fluke that is not supported by MS. If I
          build my form on this premiss, am I going to have trouble down the
          road?
          Sorry I wasn't clear. I did not reverse the listbox control itself.
          I simply referenced it's (column,row) properties for the ControlSource
          of a text box in design mode.
          Instead of Text1.ControlSo urce Property "= List1.Column(co lumn,row)"
          which is the common way.
          ("row" is the list "index" of a list box)
          I reversed the (column,row) to (row,column)
          Example: Text1.ControlSo urce "= List1.Column(ro w,column)" .
          It works every time for several dozen text boxes each referencing
          different rows and columns of the same list box.
          I just hope it keeps working and isn't just an anomaly not supported
          by MS.

          Comment

          Working...