Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    UK
    Posts
    20

    Unanswered: Combo and tables

    OK, here's what I'm trying to do:

    I have a table that holds customer data, including name and address.

    I want to have a combo box on my form that can populate the name and address fields automatically by selecting the relevant name.

    I also want to put a button on the form so that I can type in the form data, and the button will lift the name and address from the form and store it for later use in the combo box, using the same name in the combo box as the name entered.

    I guess I need 3 tables: 1 for my data, 1 for the combo box data, and 1 to store the data associated with the combo box entry.

    I also guess I need some VB code(!)

    Can somebody please shed some light on the problem for me. (Go easy please, I'm still on chapter one of the manual!!)

    Thanks in advance.

  2. #2
    Join Date
    Oct 2003
    Posts
    19

    Re: Combo and tables

    You can associate SQL query to a combo box, this way you wont need any extra table. You have to check the properties of the combo, make sure the type of record source is set to query / table and then insert in the source field:
    SELECT FieldName1, FieldName2 FROM TableName WHERE FieldNameX='Some value' ORDER BY FieldName1;

    This is just an example, the WHERE and ORDER BY parts are just optional. This is a very simple SQL query, things get more interesting as you move on :-)

    Hope this helps

    DDD
    ----------------------


    Originally posted by Mordecai [/i]
    OK, here's what I'm trying to do:

    I have a table that holds customer data, including name and address.

    I want to have a combo box on my form that can populate the name and address fields automatically by selecting the relevant name.

    I also want to put a button on the form so that I can type in the form data, and the button will lift the name and address from the form and store it for later use in the combo box, using the same name in the combo box as the name entered.

    I guess I need 3 tables: 1 for my data, 1 for the combo box data, and 1 to store the data associated with the combo box entry.

    I also guess I need some VB code(!)

    Can somebody please shed some light on the problem for me. (Go easy please, I'm still on chapter one of the manual!!)

    Thanks in advance. [/SIZE][/QUOTE]

  3. #3
    Join Date
    Nov 2003
    Location
    UK
    Posts
    20
    Thanks DDD_487. I'll give that a try later.

    This will let me choose existing names in the combo box and I can then populate the neccessary address fields right?

    Does this also work for new names when I manually enter the field data?

  4. #4
    Join Date
    Nov 2003
    Location
    UK
    Posts
    20
    Great! That brings the names up, but how do I populate the address fields for new records. Do I have to use the SETVALUE command from VB?

    If so, do I use an event procedure in the After Update or the On Change event?

Posting Permissions

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