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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a new record to table

Status
Not open for further replies.

robojeff

Technical User
Dec 5, 2008
220
US
I have a form with a combo box [part] that has a
record source of part numbers [partnum] from a table [Code_tbl).

A new number can also be entered into the combo box and
I would like to add it to the table if it does not already
exist along with its part description [partdesc] which is
in a different edit box [desc] on the form.

Is there an easy way to do this?

thanks
 
Have a look at the NotInList event.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV-

Two questions...

First question:
Does this "NotInList" event get processed before the "After Update" event is complete?

It is in the "After Update" event that I create two additional fields that i need to put in the table along with the new part number.

Second question:
is the following line of code what updates the table and the ";" separating the fields as defined from left to right?

ctl.RowSource = ctl.RowSource & ";" & NewData
 
After some investigation it appears that "NotInList" might not work in this application because this event only is activated if the "Limit to list" setting is set to Yes and a number is entered into the combo box that is not in the list.

From what I can tell, when this happens the number typed into the combo box is a Null value because it is not valid.

I also noticed that when I set the "Limit to list" setting is set to No and a number is entered into the combo box that is not in the list, in my after change event, the value typed into the combo box shows up as "can't compile module".

Is there a way to have the Combo box row source set from the table and allow new values to be entered so that the table can be updated or can't this be done with a combo box?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top