Now I see the two sets of controls. I saw only the unbound ones before. You want input through the unbound controls in the header? But the bound controls in Detail are available. This looks confusing to me. Why not just have users enter directly to the Detail record?
The AddItem button errors on the DoCmd.OpenQuery. There is no query by that name.
There is also no code to save the data from the unbound controls to the fields of RecordSource, if that is what you want to do.
I eliminated the lines concerned with the query and I get an error message about compacting the db. Removed the SaveRecord code and nothing errors but no data saved to Orders table.
OrderID combobox on TimeCards has 'no valid field' error. Price textbox in Detail section has 'no valid field' error.
Code that does not error now looks like:
Code:
If IsNull([Cat]) Or IsNull([QtyA]) Or IsNull([Prod]) Then
Me.QtyA.SetFocus
MsgBox "Quantity, Category and Material" & Chr(13) & Chr(10) & "need to be filled in."
Else
Form_TimeCards.SetFocus
Me.Cat = Null
Me.Prod = Null
Me.QtyA = Null
Me.OrdDte = Date
End If
Clarify exactly what behavior you want from this form. Do you want values entered in the unbound controls to be saved to a new record in Orders table? Do you want to allow users to edit the Detail records?