Here is the scenario: I have a table Finance with the following fields
Table Finance
Id
ProjectNo
Type
Amount
Commitments
Expenditure
Type is a combobox with the selections PR, PV, SR, PDN
This information is displayed in a subform 'Financials' with linkage to the main form via projectno and commitments and expenditure are unbound fields.
Once a type is selected, the user enters the value of the type in field ‘Amount’.
My problem starts now:
When the user selects PR, I need amount to be assigned to commitments
When the user selects PV, I need amount to be assigned to expenditure
When the user selects SR, I need amount to be assigned to commitments
When the user selects PDN, I need the commitments textbox to reflect a deduction of the value of the amount (always a negative figure) and the expenditure textbox to increase by the value entered in amount.
Also, I need the commitments and expenditure values to be posted and saved to the table.
I am thinking about placing an if statement in the AfterUpdate event of the amount textbox that would look something like
If Type=PR then
txtAmount = txtCommitments
Else
If Type = PV then
txtAmount = txtExpenditure
Else
If Type = SR then
txtAmount = txtCommitments
Else
If Type = PDN then
txtCommitments = txtCommitments - txt Amount
txtExpenditure = txtExpenditure + txt Amount
End If
End If
End If
End If
However, when I enter this code, it doesn't run. Can someone offer some assistance.
Thanks
Table Finance
Id
ProjectNo
Type
Amount
Commitments
Expenditure
Type is a combobox with the selections PR, PV, SR, PDN
This information is displayed in a subform 'Financials' with linkage to the main form via projectno and commitments and expenditure are unbound fields.
Once a type is selected, the user enters the value of the type in field ‘Amount’.
My problem starts now:
When the user selects PR, I need amount to be assigned to commitments
When the user selects PV, I need amount to be assigned to expenditure
When the user selects SR, I need amount to be assigned to commitments
When the user selects PDN, I need the commitments textbox to reflect a deduction of the value of the amount (always a negative figure) and the expenditure textbox to increase by the value entered in amount.
Also, I need the commitments and expenditure values to be posted and saved to the table.
I am thinking about placing an if statement in the AfterUpdate event of the amount textbox that would look something like
If Type=PR then
txtAmount = txtCommitments
Else
If Type = PV then
txtAmount = txtExpenditure
Else
If Type = SR then
txtAmount = txtCommitments
Else
If Type = PDN then
txtCommitments = txtCommitments - txt Amount
txtExpenditure = txtExpenditure + txt Amount
End If
End If
End If
End If
However, when I enter this code, it doesn't run. Can someone offer some assistance.
Thanks