Access Visual Basic Code to Validate Field on Current Record Equals Value of Previous Record Plus 10
I have Access 2010 on a Windows 7 PC.
I have an Access form. I just added a record and I'm creating a close form button. Before the form closes I'd like to validate the NwMtrNum field on the record I just added equals the NwMtrNum field of the previous record plus 10.
I was able to originally add 10 to the previous record when I added the new record, but I can't seem to get it to see the previous record once the new record is added. Note the "NwMtrNum" field can be overwritten and needs to be changed sometimes which is why I want to check it. This way when it's changed I can provide further instruction.
' Go to last record and get the value of the "NwMtrNum" field
intCopyNum = Me.NwMtrNum.Value
intCopyNum = intCopyNum + 10