Hi
Please help me to correct the vba code below:
I have 4 field: Date1,Date2,Date3,Type and a 1 text box called "Total" and below is the vba code which is not working as per the target output:
The target to the vba code is that:
- when the value of field "type" is A, the text box "Total" should compute field "Date3-Date2"
- when the value of field "type" is B, the text box "Total" should compute field "Date3-Date1"
Having hard time how to add the value B in the equation.
Please help me to correct the vba code below:
I have 4 field: Date1,Date2,Date3,Type and a 1 text box called "Total" and below is the vba code which is not working as per the target output:
Private Sub Total_AfterUpdate()
If Me.Type = A Then Me.Total = Me.Date3 - Me.Date2
Else
Me.Total = Me.Date3 - Me.Date1
End If
End Sub
The target to the vba code is that:
- when the value of field "type" is A, the text box "Total" should compute field "Date3-Date2"
- when the value of field "type" is B, the text box "Total" should compute field "Date3-Date1"
Having hard time how to add the value B in the equation.