Ids problem on subform
I have a for for making orders called NordersMaken with a subform NordersDetails. Here is some info on my tables:
tblOrders (=form NordersMaken)
tblOrderDetails (= Form NordersDetails)
ProductId (from tblProducts)
BlowerId (from tblBlowers)
Avail (yes/no) /for item ordered = not available (value yes/true)
uit (yes/no) / for item invoiced = out of wharehouse (value yes/true)
Available (yes/no) /for item ordered = not available (value yes/true)
out (yes/no) / for item invoiced = out of wharehouse (value yes/true)
From the form Products(tblProducts) I send the ProductId intot he subform, NordersDetails and set the focus on the main form (NordersMaken) with this:
DoCmd.OpenForm stDocName, , , , acFormAdd Forms!NordersMaken.Form!OrderDatectrl = Date Forms!NordersMaken.NordersDetails.Form!Serial = Me.ProductId
The problem: when I try to change details in the subform (NordersMaken) like Price I get an error message saying that the JETDB couldn't find the record OrderDetails.BlowerId. Just because I didn't select it. what if I don't need/want to? How could I leave it blank and/or avoid those errors?
I tried catching the error on the subform on GotFocus and on LostFocus I added this:
If Err = 3101 Then Err.Clear
I already changed the relationships from one-to-many to normal for 'tblProducts' and 'tblBlowers' with 'tblOrderDetails'. But the error keeps appearing and doesn't let me do anything else if I don't select them both. Any suggestions?