RE: how do i create a combo box?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks a lot, but I am still a little confused. My table is called
Associates. The fields I want to use on my form are First, Last, Telephone,
ext, emp #. Right now I have two combo boxes. One for first name, the other
for last name. I would like that once I select a first name, i can select
from all of the last names that have the same first name. Once I have a
match, it puts in the telephone, ext and empl # in the other fields. If that
is what you explained already, thanks and sorry to seem like a nimwit.

"Sprinks" wrote:

> Hi, DKS1.
>
> A combo box has several key properties which control how it behaves:
>
> Control Source
> The field in the form's underlying RecordSource in which to store the user's
> selection, as defined by the BoundColumn property. This is normally a
> numeric key field that uniquely identifies the record.
>
> RowSource
> An SQL query statement that "populates" the rows of the combo box. This can
> include both standard and calculated fields.
>
> BoundColumn
> The index, beginning with 1, of the column to be stored in the ControlSource
> when the user makes the selection. Normally, this is set to 1 so that the
> key field is stored.
>
> ColumnWidths
> How much space on the screen is allocated to each column in the drop-down
> list, separated by semi-colons. When the user makes a selection, the first
> non-zero width column is displayed.
>
> So, in your case, your combo box is likely to be bound to (i.e., its
> ControlSource is set to) a numeric EmployeeID field.
>
> The RowSource, assuming that the last name and first name are separate
> fields, and that you'd like to display them in "LastName, FirstName" format,
> would be:
>
> SELECT YourTable.EmpID, [LastName] & ", " & [FirstName] AS EmpName,
> [PhoneNumber], [Location]
> FROM YourTable
> ORDER BY [LastName] & ", " & [FirstName];
>
> You would replace "YourTable" with the name of your employee table, and
> adjust the fieldnames as appropriate.
>
> Set the BoundColumn to 1. Be sure that the ControlSource matches type with
> the EmpID field. Normally both would be the Integer or AutoNumber type.
>
> To display only the name in the dropdown, set the ColumnWidths property to:
>
> 0";x";0";0"
>
> where x is large enough to display the longest name.
>
> Finally, to display any of the other columns in a separate textbox, use the
> combo box' Column property to set the textbox' ControlSource property:
>
> =YourComboBox.Column(Index)
>
> where Index is the column number, beginning with 0. For example, to display
> the PhoneNumber in a textbox (the 3rd column), assuming your combo box is
> named cboEmpName, set the textbox' ControlSource to:
>
> =cboEmpName.Column(2)
>
> If your EmpName field is a single field rather than separate Last and First
> names, you can also use the wizard to create the combo box. Select "Hide Key
> Field" to set the first Column Width to zero, then size the others
> dynamically on screen, and follow the rest of the prompts. To enable the
> wizard from form design view, select View, Toolbox, and toggle on the button
> with the wand and stars.
>
> Hope that helps.
> Sprinks
> "DKS1" wrote:
>
> > Newbie User:
> > I am trying to create a form which contains a combo box. Now the combo box
> > is based on fields from one table that lists the employees names. I want to
> > be able to select the first and last name for an employee, and then have
> > Access include the corresponding information into the fields I list.
> > For example, If i select Miles Davis, I would want to see his telephone #,
> > location, and employee number automatically without having to select them
> > from a list of over 1500. Is there an easy way to do this?
> >
> > thanks
.



Relevant Pages

  • RE: how do i create a combo box?
    ... > The index, beginning with 1, of the column to be stored in the ControlSource ... > fields, and that you'd like to display them in "LastName, FirstName" format, ... >> is based on fields from one table that lists the employees names. ... >> be able to select the first and last name for an employee, ...
    (microsoft.public.access.forms)
  • Re: Automatically Populate Field
    ... If the dropdown includes the Project Number, you can refer to and display it ... in a textbox by creating an unbound textbox and making it's source be: ... OnChange of the dropdown, ... use of a form where an employee selects the project name from a drop down ...
    (microsoft.public.access.forms)
  • Re: combo box columns and key input
    ... In my previous post I should not have said the UnBound TextBox did not ... this value is just for display purposes. ... and if you hit 0 the ComboBox displayed None ... In the TextBox's ControlSource I'd use ...
    (comp.databases.ms-access)
  • RE: how do i create a combo box?
    ... The index, beginning with 1, of the column to be stored in the ControlSource ... To display only the name in the dropdown, ... Finally, to display any of the other columns in a separate textbox, use the ... > be able to select the first and last name for an employee, ...
    (microsoft.public.access.forms)
  • RE: how do i create a combo box?
    ... >> The index, beginning with 1, of the column to be stored in the ControlSource ... >> where x is large enough to display the longest name. ... >>> is based on fields from one table that lists the employees names. ... and employee number automatically without having to select them ...
    (microsoft.public.access.forms)