Combo box problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ray Bell

    Combo box problem.

    There are 2 tables, a table called parent and a table called child.

    The parent table has 2 fields, an ID (AUTO Number: PK) and Name
    (Parent Name)

    The Child Table has 3 fields, an ID (AUTO Number: PK), ParentID(FK to
    ID in parent Table) and Name(Childs Name)

    The tables are related by the ID and ParentID

    I want to create a form for entering child names but on that form I
    want to select the Parent Name and then enter the childs name.

    Can I have a combo box that has a list of parent's names but when you
    enter the information it only enters the ID of the Parent into the
    child table.

    This is done easily with a list box in HTML where the bound column is
    the value that is passed where as the text value is displayed.

    Can this be done in Access 2003?

    Thanks.
    Ray
  • David B

    #2
    Re: Combo box problem.

    Yes
    Let the wizard build the combo for you. Should be easy
    HTH
    David B

    Ray Bell <raymondbell@ho tmail.com> wrote in message
    news:f69e3e5c.0 404190927.641c4 b26@posting.goo gle.com...[color=blue]
    > There are 2 tables, a table called parent and a table called child.
    >
    > The parent table has 2 fields, an ID (AUTO Number: PK) and Name
    > (Parent Name)
    >
    > The Child Table has 3 fields, an ID (AUTO Number: PK), ParentID(FK to
    > ID in parent Table) and Name(Childs Name)
    >
    > The tables are related by the ID and ParentID
    >
    > I want to create a form for entering child names but on that form I
    > want to select the Parent Name and then enter the childs name.
    >
    > Can I have a combo box that has a list of parent's names but when you
    > enter the information it only enters the ID of the Parent into the
    > child table.
    >
    > This is done easily with a list box in HTML where the bound column is
    > the value that is passed where as the text value is displayed.
    >
    > Can this be done in Access 2003?
    >
    > Thanks.
    > Ray[/color]

    Comment

    • Don Leverton

      #3
      Re: Combo box problem.

      Hi Ray,

      I'd suggest a mainform / subform approach

      Main form: frmParent based on tblParent
      Sub form: sbfChildren based on tblChildren
      LinkMaster : ID (or ParentID, if you follow my advice below.)
      LinkChild : ParentID

      Use a combo box ("cboParent" ) on the main form to find/display a
      "ParentName " record with all of the associated information.
      (Use the wizard ... "find a record on my form" option... assuming wizard is
      still the same as Access97.)

      The subform would allow you to enter/view the related children. The ParentID
      is automatically entered into new subform records for you via the LinkMaster
      / LinkChild subform link.

      Simple, easy, done. :)
      --------------------------------------------

      And now for some "been there... done that" advice.) <grin>
      -----------------------------------------------------
      1.) I'd like to caution you on your choice of field names... "Parent",
      "Child", and especially "Name" are all words that should be considered
      "reserved" Access program names and / or properties. Also, NEVER use spaces
      in field names... and only use ALLCAPS / underscores as a last resort...
      thats " *so* Dbase III " !
      (All of this will make more sense to you if / when you start writing some
      VBA code .... )

      2.) I'd suggest disambiguating your "ID" fields in both of your tables.
      Every time that you try to create a query, Access will assume that "ID" is
      the join field, and you will have to change it manually.

      Personally, I'd do it like this:

      tblParent
      ---------
      ParentID - AutoNumber - PK

      tblChildren
      -----------
      ChildID - AutoNumber - PK
      ParentID - Long Integer - FK


      --
      HTH,
      Don
      =============== ==============
      Use My.Name@Telus.N et for e-mail
      Disclaimer:
      Professional PartsPerson
      Amateur Database Programmer {:o)

      I'm an Access97 user, so all posted code
      samples are also Access97- based
      unless otherwise noted.

      Do Until SinksIn = True
      File/Save, <slam fingers in desk drawer>
      Loop

      =============== =============== ==


      "Ray Bell" <raymondbell@ho tmail.com> wrote in message
      news:f69e3e5c.0 404190927.641c4 b26@posting.goo gle.com...[color=blue]
      > There are 2 tables, a table called parent and a table called child.
      >
      > The parent table has 2 fields, an ID (AUTO Number: PK) and Name
      > (Parent Name)
      >
      > The Child Table has 3 fields, an ID (AUTO Number: PK), ParentID(FK to
      > ID in parent Table) and Name(Childs Name)
      >
      > The tables are related by the ID and ParentID
      >
      > I want to create a form for entering child names but on that form I
      > want to select the Parent Name and then enter the childs name.
      >
      > Can I have a combo box that has a list of parent's names but when you
      > enter the information it only enters the ID of the Parent into the
      > child table.
      >
      > This is done easily with a list box in HTML where the bound column is
      > the value that is passed where as the text value is displayed.
      >
      > Can this be done in Access 2003?
      >
      > Thanks.
      > Ray[/color]


      Comment

      Working...