Trying again:
I want to populate a table (tblMHDPlantList) with records from another table (tblPlantList) using a combo box in a form. I then want to update the new tblMHDPlantList records in the form. The combo box works if the record is already in tblMHDPlantList. However, when I select a new plant to add from the combo box (unbound to tblPlantList) I get the message: “Index or primary key cannot contain a null value.” TblMHDPlantList also has foreign ID key to tbl_Plant_Type. I have another combo box to choose plant type.
I am able to update tblMHDPlantList by adding the table as a subform/subreport to a form that also allows me to add new plants to tblPlantList. However, this is in table form and doesn’t allow me to use combo boxes, which I need because ID key numbers don’t mean much to a user.
Is there some kind of code that I need to tell tblMHDPlantList to add a new autonumber field if the ID number (from cboBox) is not already in the table? I don’t know how to write code and I have been stuck with this for a long time!!
Thank you!
I want to populate a table (tblMHDPlantList) with records from another table (tblPlantList) using a combo box in a form. I then want to update the new tblMHDPlantList records in the form. The combo box works if the record is already in tblMHDPlantList. However, when I select a new plant to add from the combo box (unbound to tblPlantList) I get the message: “Index or primary key cannot contain a null value.” TblMHDPlantList also has foreign ID key to tbl_Plant_Type. I have another combo box to choose plant type.
I am able to update tblMHDPlantList by adding the table as a subform/subreport to a form that also allows me to add new plants to tblPlantList. However, this is in table form and doesn’t allow me to use combo boxes, which I need because ID key numbers don’t mean much to a user.
Is there some kind of code that I need to tell tblMHDPlantList to add a new autonumber field if the ID number (from cboBox) is not already in the table? I don’t know how to write code and I have been stuck with this for a long time!!
Thank you!