Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating combo box (Access 2003)

    Hello!

    I have one trouble about creating combo boxes. I want to create combo box from one table, and combo box should contain unique ID.

    Here is example:

    Table Customers

    Customer ID Company Name
    1 Company A
    2 Company B
    3 Company C

    etc

    I want next: when I choose Customer ID 1 from combo box, I want to fill Company Name field with Company A, when I choose ID 2, I want to fill Company Name field with Company B

    etc

    could anyone tell me what I need to do (what to choose) in each step in combo box wizard?

    Thanks

    Slaven

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    Hello Slaven,

    I assume that you want to create the combo box on a form bound to another table.
    In the first step of the Combo Box wizard, select the 1st option ("I want the combo box to look up the values in a table or query"), then click Next.
    In the second step, select your Customers table, then click Next.
    In the third step, add the Company ID and Company Name fields to the list on the right (select the fields and click the > button). Then click Next.
    In the fourth step, Access will propose to hide the key column. This is OK. Adjust the column width if necessary, then click Next.
    In the fifth step, click "Store that value in this field" and select the Company ID field from the dropdown list. Then click Next.
    In the sixth and final step, enter a descriptive label for the combo box, then click Finish.

    The combo box will display the Company names, but it will store the Company ID field.

  3. #3
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    Hello!

    I followed your instructions, but attempt failed. I really don't know what is wrong.

    When I am in Form view, this doesn't work.

    Why?

    Slaven

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    Without knowing the details, it's had to say. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

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

    Re: Creating combo box (Access 2003)

    If you describe exactly what does happen in form view, someone may be able to help. Simply stating that it isn't working doesn't really give enough information for anyone to diagnose the problem.
    Charlotte

  6. #6
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    Here is zip file with this database

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    You may have stripped away too much - the database contains only one table, and no forms. Please attach a database with the form you are trying to create.

  8. #8
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    Here is file with form in it.

    Slaven

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    My original reply assumed that you had a form based on another table than Customers. In your customers form, you probably want to use the combo box to find a record. For this, you must select the 3rd option in the Combo Box wizard: "Find a record on my form based on the value I selected in my combo box". The rest is similar to my previous reply.

    See the attached version. The combo box is in the form header section.

  10. #10
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    Hello!

    This solution can be accepted [img]/forums/images/smilies/biggrin.gif[/img] . But, I want to do next: to transform a text box labeled Customer ID to combo box labeled Customer ID (to replace text box with combo box). If you can do this, and give me steps how to do this, I will be very thankful.

    Slaven

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    That doesn't make sense in the Customers form. By selecting a different Customer ID, you'd be changing the ID in the current record. That can't be done.
    If you had a form based on another table, say an Orders table, you could use a combo box to select a Customer ID for the current order.

  12. #12
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    Can next be done:

    if I choose ID 2 from Customer ID combo box, can I see Company B in Company Name text box? I yes, please give me instructions how to do that. If not, give me instructions how you made changes to my original form.

    If you can give me answer to any of these two questions, I will be very thankful.

    Thanks

    Slaven

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    Hi Slaven,

    I think there is some kind of misunderstanding here.

    I repeat: what you want would make sense in a form based on another table that has a Customer ID field. You could have a combo box there to select a Customer ID, and display the customer name in a text box next to it.

    In your customers form, you cannot do that.

    I used the Combo Box wizard to create the combo box on the form in the database I attached higher up in this thread. I selected the 3rd option, then followed the instructions.

  14. #14
    Star Lounger
    Join Date
    Aug 2005
    Location
    Novi Sad, Serbia and Montenegro (Yugoslavia)
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating combo box (Access 2003)

    I understand that it is impossible to make it work on a way how I want. But, can you tell me why, and is there a way to make it work how I want? And if there is a way, how to do this?

    If there is no way, may you give me exact instructions how to make "your" combo box? (combo box that you made in my form)

    Thanks

    Slaven

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating combo box (Access 2003)

    A combo box can be used for different purposes. The most important are:
    <UL><LI>To select the value of a field from a list. Usually, this field is in another table than the table that provides the list.
    Example: you have a table with orders. For each order, there is a customer. The customer has to be chosen from those in the customers table.
    On the orders form, you place a combo box bound to the customer field in the orders table. The row source of this combo box is the customers table.
    When the user selects a customer from the list, the customer field in the orders table is changed.
    <LI>To find an item in a field in a table.
    Example: you have a form based on the customers table. When the user selects a customer from the combo box, the code behind the combo box searches for that customer in the table, then displays the corresponding record in the form. In this situation, the row source of the combo box is based on the same table as the form.[/list]You cannot combine these two functionalities in the same combo box - it would lead to conflicts.

    I have already told you how I created the combo box in the database I attached:
    - In the first step of the Combo Box wizard, I selected the 3rd option.
    - In the second step, I added the ID field and the Customer Name field to the list on the right hand side.
    - In the third step, I adjusted the column width.
    - In the final step, I entered a caption for the label next to the combo box.
    The Combo Box wizard then created the VBA code that makes the combo box work.

Page 1 of 2 12 LastLast

Posting Permissions

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