i have an invoice form just like in the northwind database.
the problem is the invoice can be saved without the user have to input any products in the subform.
so when the user input the information in the main form and then saves it, it can be saved.
i want the invoice can't be saved when there's no products in the subform. you know it's like writing an invoice but there's nothing to buy.
thanks a lot
I assume you are referring to the Orders form and subform in the Northwind database. One solution is to do a record count in the AfterUpdate event of the form that would determine if there are any rows in the subform that match the OrderID in the main form. If you come up with zero, then you would have to delete the current record since the data in the main form might already be committed.
The code would be something like:
If DCount("*",RecordSourceOfSubform,"OrderID = " & Me!OrderID) = 0 Then