By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,136 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,136 IT Pros & Developers. It's quick & easy.

Combo box problem.

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Yes
Let the wizard build the combo for you. Should be easy
HTH
David B

Ray Bell <ra*********@hotmail.com> wrote in message
news:f6**************************@posting.google.c om...
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


Nov 12 '05 #2

P: n/a
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*****@Telus.Net 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" <ra*********@hotmail.com> wrote in message
news:f6**************************@posting.google.c om...
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

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.