I have two requests please.
We have created a Projects database which has a number of subforms, one of which is comments. It has three fields - Date, Who, Comment
Elsewhere on the Main Form there is a comments field from an earlier version. I would like to move these comments to the subform and then delete the original comments field.
Is there some code that would achieve that please, or do I export and re import. Any advice appreciated.
The second request relates to managing Project value. On the main form I have a Value field. I also have an invoice subform which records Invoice Number, Date of Invoice, Invoice Value. I would like to have a running diminishing total - for example
Main form invoice value - $10,000.00
Inv 22 - 26 April 2016 - $3200.00 Balance - $6800.00
Inv 34 - 26 May 2016 - $985.00 Balance - $5815.00
Inv 57 - 26 June 2016 - $4700.00 Balance - $1115.00
Etc
I assume that once the various amounts are entered into the subform and saved, then this information “disappears” from a form but is shown in the relevant report.
Any advice would be appreciated
**********************************
UPDATE
The first question has been resolved - there were only a small number of entries
Question 2 I have prepared this script where PROJECT is the sub form
Project
(
displayname = "Project Approvals"
type = grid
values = Project_Sub_Form.ID
Contractor
(
on user input
{
grandTotal = 0.0;
for each Contractor in Project
{
if (Project.Value != null)
{
grandTotal = (grandTotal + Project.Value);
}
input.Sub_Total = grandTotal;
}
}
)
)
Sub_Total
(
displayname = "Sub Total"
type = NZD
width = 200px
)
In part this works. When I enter a value in the first line - say 10, the Sub_Total field also populates as 10
When I enter another value in the new row say 12, I was expecting Sub_total to increase to 22. But instead it become 20. And likewise with a third row say 5 expecting the Sub_Total to become 27, it becomes 30.
So there is something wrong with my script as it appears to multiply the first value entered by the number of rows.
I should explain the fields in the sub form are:
Date Awarded
Value
Contractor
Contact
Mobile
Divider