I am adding extra to the Db and have run into the following
CR_No Default = DLast("CR_No","Change Request")
But I want to add +1 to the CR_No when another fieled = true,otherwise leave it as is.
I am trying to use the following as code in VBA to try and do that:
Private Sub CR_Number_AfterUpdate()
If Me.Action_Complete = DLast("Action_Complete", "Change Request") = Yes Then
Me.CR_Number = DLast("CR_No", "Change Request") + 1
Else
Me.CR_Number = DLast("CR_No", "Change Request")
End If
If Me.CR_Number <> DLast("CR_No", "Change Request") Then
Me.Sub_Num = 0
Else
Me.Sub_Num = DLast("Sub_No", "Change Request") + 1
End If
End Sub
The second If then works like I want it to. So if the first runs and meets the criteria, then it sould be the next CR_No + 1 with Sub_Num = 0. If I manually change it, Sub_Num resets to 0.
I want the value to show up in the form when iot opens to a new record. I am thinking I need to change the default value.
Suggestions?