In my Access table I have a ON/OFF field name "rowlock". I have a form to fill up the table. The form has filter property RowLock = FALSE. Hence it will show only those records for which "rowlock" filed on the table is false. I have set criteria to turn the field to True only if all of the fields are filled up in the form. I used the following code on the Before update event of the form to satisfy the criteria, but the program crashed and says "Runtime Error 94. Invalid use of Null" and highlights the code.
Code:
Me.rowlock = (Nz(Me.txtOP_SmallQty, 0) > 0 And Nz(Me.cboCNFID, 0) > 0 And Nz(Me.txtOP_CNF_Bill, (-1)) > (-1) And Nz(Me.txtOP_Invoice_, "") <> "" And Nz(Me.txtOP_InvoiceDt, "") <> "" And Nz(Year(Me.txtBL_Dt), 1901) <> 1901 And Nz(Me.txtB_E_No, "") <> "" And Nz(Me.txtOP_B_E_Dt, "") <> "" And Nz(Me.txtOP_Bond_, "") <> "" And Nz(Me.txtOP_Bond_Dt, "") <> "" And Nz(Me.txtIn_BondDt, "") <> "" And (Me.chkGoodsArrived <> False) And (Me.chkDocArrived <> False))
The code used to work when the criteria was a bit fewer.
However, I have find out which part of the code is doing the problem. It is
Code:
And Nz(Year(Me.txtBL_Dt), 1901) <> 1901
It is a date field. I could have wrote it as
Code:
And Nz(Me.txtBL_Dt), "") <> ""
But I wanted for a provision for unknown values so that for the value I don't have I could put 01/01/1900 and the criteria won't interact with this.
Could you tell me what is wrong with this part of the code?