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

Combo box question

P: n/a
I'm creating a data entry form for my primary table (birds observed)
and want to use a combo box that refers to a lookup table (locations).
I've set the combo box to except new locations (ones not in the
table). This populates the location field in the primary table okay,
but it does not add the new location to the lookup table. Is there a
way to make this happen automatically? Thanks in advance for any help.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 04 Feb 2005 21:49:49 -0500, RustyMoran <hm****@erols.com>
wrote:

Seems like something is incorrect in your database design. You are
saying the new location is added to tblBirdsObserved, but not to
tblLocations?
Proper relational db design would mandate this structure:
tblBirdsObserved with fields including LocationID
tblLocations with fields LocationID, LocationName, etc.
There would be an enforced referential integrity link between the two
tables, ensuring the first table can only have LocationID values that
occur in the Locations table. This would make your current behavior
impossible.

Then you design a 2-column combobox that pulls LocationID,
LocationName from the Locations table; LocationID is a 0-width column,
and is the bound column. The way I think about it is that a combobox
is an ideal tool to give the db what it wants (ID values) while giving
the humans what they want (Name values). The human thinks she is
selecting a name, while under the hood we are storing an ID value.

The combobox would be limit to list, and if you enter a location that
does not yet exist, the NotInList event fires. There you can write
code to add the new location to the table (perhaps using an Append
query), and have Access reload the combobox and try to find the value
again.

Happy programming.

-Tom.
I'm creating a data entry form for my primary table (birds observed)
and want to use a combo box that refers to a lookup table (locations).
I've set the combo box to except new locations (ones not in the
table). This populates the location field in the primary table okay,
but it does not add the new location to the lookup table. Is there a
way to make this happen automatically? Thanks in advance for any help.


Nov 13 '05 #2

P: n/a
Tom, I haven't had a chance to try your suggestions, but I will.
Thanks a lot. Rusty

On Fri, 04 Feb 2005 21:11:47 -0700, Tom van Stiphout
<no*************@cox.net> wrote:
On Fri, 04 Feb 2005 21:49:49 -0500, RustyMoran <hm****@erols.com>
wrote:

Seems like something is incorrect in your database design. You are
saying the new location is added to tblBirdsObserved, but not to
tblLocations?
Proper relational db design would mandate this structure:
tblBirdsObserved with fields including LocationID
tblLocations with fields LocationID, LocationName, etc.
There would be an enforced referential integrity link between the two
tables, ensuring the first table can only have LocationID values that
occur in the Locations table. This would make your current behavior
impossible.

Then you design a 2-column combobox that pulls LocationID,
LocationName from the Locations table; LocationID is a 0-width column,
and is the bound column. The way I think about it is that a combobox
is an ideal tool to give the db what it wants (ID values) while giving
the humans what they want (Name values). The human thinks she is
selecting a name, while under the hood we are storing an ID value.

The combobox would be limit to list, and if you enter a location that
does not yet exist, the NotInList event fires. There you can write
code to add the new location to the table (perhaps using an Append
query), and have Access reload the combobox and try to find the value
again.

Happy programming.

-Tom.
I'm creating a data entry form for my primary table (birds observed)
and want to use a combo box that refers to a lookup table (locations).
I've set the combo box to except new locations (ones not in the
table). This populates the location field in the primary table okay,
but it does not add the new location to the lookup table. Is there a
way to make this happen automatically? Thanks in advance for any help.


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.