I have a form that I'm trying to populate. This a summary form. I already have a details form which calculates and shows all the necessary data for a particular item. My problem is that in the summary form I want to show a particular value that I'm already showing in the details form. This value is computed by performing queries and then calculations using the query results. Below is an example of one of the queries.
Basically the formula that I'm using is:
spi = ev / pv
cpi = ev / ac
avgIndex = (spi + cpi) / 2
ev, pv and ac are derived from summing up their respective columns from another table.
So what I'm trying to do is show a avgIndex for each item on my summary form but I don't know how to perform all the calculations I need and insert the result into a query so that I can have the avgIndex show up in a listbox. The code I'm currently using to generate this listbox is below:
What I want is:
P.S. - the Details doesn't exists until I double click on an item in the summary page. Once i do that it shows the detail page for that item. So I'm thinking I won't be able to reference the value that I need from my details page since it needs to show up before I even click to open the details page.
Update
Just to further explain my issue. I want my listbox on the summary page to look something like this:
Doc No. #1 | BAC | AC | PV | EV | AVG Index | Color_block
Doc No. #2 | BAC | AC | PV | EV | AVG Index | Color_block
Doc No. #3 | BAC | AC | PV | EV | AVG Index | Color_block
Each of the values above is a computed value. So is this possible to achieve? Please tell me it is and if so how do I achieve this?
P.S. the color_block is where I want to show a color based on the value of AVGIndex for that particular item.
Code:
'Sum all planned amounts of tasks associated with funding doc Dim objRS As ADODB.Recordset Dim colName As String colName = "PLANNED_AMT" Set objRS = New ADODB.Recordset objRS.Open "SELECT Sum(" & colName & ") FROM TASKS WHERE (((TASKS.[FUNDING_DOC_ID_FK])=" & _ fPrevious.lbFundingDocs & ") AND ((TASKS.[" & colName & "]) Is Not Null));", CurrentProject.Connection If Not objRS.EOF Then bac = objRS.Fields(0).Value End If objRS.Close Set objRS = Nothing
spi = ev / pv
cpi = ev / ac
avgIndex = (spi + cpi) / 2
ev, pv and ac are derived from summing up their respective columns from another table.
So what I'm trying to do is show a avgIndex for each item on my summary form but I don't know how to perform all the calculations I need and insert the result into a query so that I can have the avgIndex show up in a listbox. The code I'm currently using to generate this listbox is below:
Code:
Me.lbFundingDocs.RowSource = "SELECT ID, FUNDING_DOC_NO AS [Funding Doc No], FUNDING_TYPE AS [Funding Type], EXP_DATE AS [Expiration Date] FROM FUNDING_DOC;"
Code:
Me.lbFundingDocs.RowSource = "SELECT ID, FUNDING_DOC_NO AS [Funding Doc No], FUNDING_TYPE AS [Funding Type], EXP_DATE AS [Expiration Date], AVGINDEX FROM FUNDING_DOC;"
Update
Just to further explain my issue. I want my listbox on the summary page to look something like this:
Doc No. #1 | BAC | AC | PV | EV | AVG Index | Color_block
Doc No. #2 | BAC | AC | PV | EV | AVG Index | Color_block
Doc No. #3 | BAC | AC | PV | EV | AVG Index | Color_block
Each of the values above is a computed value. So is this possible to achieve? Please tell me it is and if so how do I achieve this?
P.S. the color_block is where I want to show a color based on the value of AVGIndex for that particular item.
Comment