Add new record from a bound combo box

J

JoeJohn

Hello All,

I need a help with the form coding.
How to append a new record into a lookup table using a bound combo
box?
In my entry form, I have this cboAgencyID combo box with the rowsource
= "SELECT AGENCY.AgencyID, AGENCY.AgencyName FROM AGENCY;".

I want to enable this combo box for inserting a new record into AGENCY
table, so that whenever the user type a value which is not in the
list, the value will be automatically added as a new record.

Could anyone guide me with the steps and some code examples? It would
be highly appreciated. Many thanks in advance.
-Johanes-
 
C

Craig

Make sure that the limit to list property is set to true.
In the NotInList event open up the table using DAO/ADO
that is the record source for the cbobox and add the data
which is passed as the NewData string. Finally for the
response argument add this line:"Response=acDataErrAdded"

Good luck
-Craig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top