I'm pulling my hair out here I have a Purchase Order form the main form is from query from the PO header table and then a subform (for the line detail) from a query from the PO Detail table.
I have the following code in the "Before Update" event to add an incremental line number to each of the individual PO Lines. I Have this code working fine in the Sales order part of the Database but for some reason the same code is not working here:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strWhere As String
strWhere = "PONumber = """ & Me.Parent!PONumber & """"
Me!LineNumberID = Nz(DMax("LineNumberID", "tblPurchaseOrderDetail", strWhere), 0) + 1
End Sub
I'm getting the error: - Runtime error '3464' data Type Mismatch in criteria expression? I don't know why can anyone of you gurus help at all?
The LineNumberID field in the table tblPurchaseOrderDetail is of data type Number - Long Integer
The PONumber Field in both the Header and Detail Tables are again both defined as data type Number - Long Integer
Thanks