Combo Box Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Taylor

    #1

    Combo Box Help

    I think this is easy for a guru but I've been bashing my head for hours.

    I have a drop down box in a form that looks up details from a table.

    There are two fields in the drop down box and I would like to store both of
    these fields into two fields on the form.

    i.e:-

    Drop down box has "ContName" and "ContLocati on"

    I want to select from the drop down and store: -

    "ContName" from the drop down box to "ContMainNa me" on the form
    and store "ContLocati on" from the drop down box to "ContMainLocati on" on the
    form

    Can this be done?

    Is there an easier way of doing it??

    Thanks in advance

    I'm using A2002, Win XP

    John Taylor


  • salad

    #2
    Re: Combo Box Help

    John Taylor wrote:
    [color=blue]
    > I think this is easy for a guru but I've been bashing my head for hours.
    >
    > I have a drop down box in a form that looks up details from a table.
    >
    > There are two fields in the drop down box and I would like to store both of
    > these fields into two fields on the form.
    >
    > i.e:-
    >
    > Drop down box has "ContName" and "ContLocati on"
    >
    > I want to select from the drop down and store: -
    >
    > "ContName" from the drop down box to "ContMainNa me" on the form
    > and store "ContLocati on" from the drop down box to "ContMainLocati on" on the
    > form
    >
    > Can this be done?
    >
    > Is there an easier way of doing it??
    >
    > Thanks in advance
    >
    > I'm using A2002, Win XP
    >
    > John Taylor
    >
    >[/color]
    Combo boxes are a list of rows and columns. So I'll assume name is
    column 1 and location column2. In a combo box, the index starts at 0 so
    you need to reference the first column with 0 to number of columns -1.

    Me.ContName = Me.Combobox.Col umn(0)
    Me.ContLocation = Me.Me.Combobox. Column(1)

    If you are using a listbox or combo and you know the row you can also do
    something like
    Me.ContName = Me.Combobox.Col umn(1,0)
    if it is the first element of row2.

    Comment

    Working...