Update parent table from child's form

  • Thread starter Thread starter Kostas
  • Start date Start date
K

Kostas

This one has been bugging me for a long time.
Assume a parent table DEVELOPER and a child table SOFTWARE. One developer
has many software programs. In the SOFTWARE form I choose the Developer from
a combo box that looks up the name of the developer in the DEVELOPER table.
I d like to type in a new developer name and have it added to the DEVELOPER
table from the SOFTWARE form.
My current obvious workaround solution is to update the DEVELOPER table
first then choose this developer from the drop down menu in the SOFTWARE
form....

From Access Help
"When the LimitToList property of a bound combo box is set to No, you can
enter a value in the combo box that isn't included in the list. Microsoft
Access stores the new value in the form's underlying table or query (in the
field specified in the combo box's ControlSource property), not the table or
query set for the combo box by the RowSource property. To have newly entered
values appear in the combo box, you must add the new value to the table or
query set in the RowSource property by using a macro or Visual Basic event
procedure that runs when the NotInList event occurs."

So I can set the LimitToList to No, but where can I find a sample VBA
procedure that does what I need?

I believe this has to be one of the most common questions for new access
developers
Thanks for any help,

Kostas
 
I believe you'll find an example of adding a record to a limit-to-list combo
box in the Solutions sample database. For Access 97 and earlier, it was
included in the install disks/CD; for Access 2000 and later, it can be
downloaded from where it is temporarily hosted
http://www.mvps.org/access/downloads/bapp2000.exe.

Larry Linson
Microsoft Access MVP
 
Ok, a little more searching got me to Allen's page and this article

NotInList: Adding values to lookup tables
http://members.iinet.net.au/~allenbrowne/ser-27.html

but I still get errors. For instance I write "Company Alpha" in the textbox,
the procedure kicks in and gives me an incorrect datatype conversion error,
probably because it tries to add this value to the autonumbered primary key
of the DEVELOPER table.

In case this might help somebody help me, here are the two important
properties of the combo box in question:

1) Control Source: DeveloperID
2) Row Source:
SELECT DEVELOPER.DeveloperID, DEVELOPER.DeveloperName FROM Developer ORDER
BY [DeveloperName];

Kostas
 
Back
Top