Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding multiple fields using Not In List of combo box 1

Status
Not open for further replies.

lppa

Technical User
Apr 5, 2004
26
US
Having problem with adding multiple fields from one table to another using Not In List event of the combo box.

I have two tables: Customers (Customers Name, Address, State, City, Zip) and Invoices (Invoice Name, Address, State, City, Zip). Form Invoices has combo box Customers Name, sourced by table Customers. How can I add values from Form Invoices to corresponding fields in Form Customers using Not In List event of the combo box.

Any suggestions.
Thanks.
 
Use the Not In List event to open the Customers form, and then simply copy the data from your Invoices field to the corresponding field in the Customers form

Code:
DoCmd.OpenForm "Customers",,,, acFormAdd
Forms!Customers.Name = Me.Name
Forms!Customers.Address = Me.Address
...
...
...
DoCmd.Save acForm, "Customers"
DoCmd.Close acForm, "Customers"

With this type of action, it is usually a good idea to give a warning that this is about to happen, and give the user an opportunity to cancel if they do not want to add the new record.

HTH
Lightning
 
Hi

See FAQ faq702-4283 in this forum, it shows how to open form on not in list, and that together with suggestion from Lightning (if you want to prepopulate) gives the general idea

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top