BofRossClan
Technical User
I have an invoicing form. My customer information is in table "Billing Address", and the details are in table "Billing Estimator".
In my form, I have the option of adding catering items from three different tables using a pop up form.
My difficulty is in getting the ID assigned to the customer to also be assigned to the detail records. I have been trying to do this with a query from the pop up form:
Unfortunately, it keeps telling me it can't assign a null number. I believe the customer address needs to be saved first, so I tried using this code when I open my pop up form:
This is not working either.
Is there another way to save the record? Or am I missing something else? Maybe there is another way to add the records? I have considered creating a combo box, and adding buttons that would change the underlying code of the combo box to the corresponding table. I do want the ability to type in my own information, and I want the information copied into the table, not referenced with a query.
In my form, I have the option of adding catering items from three different tables using a pop up form.
My difficulty is in getting the ID assigned to the customer to also be assigned to the detail records. I have been trying to do this with a query from the pop up form:
Code:
'add record
DoCmd.RunSQL "INSERT INTO [Billing Estimator] ( [Item Name], Unit, Price ) SELECT [Catering brochure].ItemName, [Catering brochure].Unit, [Catering brochure].Cost FROM [Catering brochure] WHERE ((([Catering brochure].ItemName)=[Forms]![Select Catering Items Popup]![cmbItemName]));"
'update id
DoCmd.RunSQL "UPDATE [Billing Estimator] SET [Billing Estimator].ID = [Forms]![Billing Estimator Entry1]![ID] WHERE ((([Billing Estimator].ID)=0));"
Unfortunately, it keeps telling me it can't assign a null number. I believe the customer address needs to be saved first, so I tried using this code when I open my pop up form:
Code:
DoCmd.RunCommand acCmdSaveRecord
This is not working either.
Is there another way to save the record? Or am I missing something else? Maybe there is another way to add the records? I have considered creating a combo box, and adding buttons that would change the underlying code of the combo box to the corresponding table. I do want the ability to type in my own information, and I want the information copied into the table, not referenced with a query.