I have a database with an input form which has many child forms. Each of the child forms should for the form add up to a certain number, for this example, 100%. If the result diviates from this number, I need to present a popup box to warn the user and force them to correct the value. This pop up I can do with little problem, what I'm struggling with is turning the query result into the variable to put into the pop up.
The query is:
SELECT [Tbl-InvCase].ProjectID, [Tbl-InvCase].Gateway, Sum([Tbl-InvCase].[IC%]) AS [SumOfIC%]
FROM [Tbl-InvCase]
GROUP BY [Tbl-InvCase].ProjectID, [Tbl-InvCase].Gateway
HAVING ((([Tbl-InvCase].ProjectID)=fnProjectID()) AND (([Tbl-InvCase].Gateway)=fnGateway100()));
The return that I need to make a variable is SumOfIC%. Variable has been defined as intICcheck.
The code I have on leaving the child form is:
Private Sub Sub_InvCase_Exit(Cancel As Integer)
putProjectID Me.ProjectID.Value
putGateway100 Me.Gateway.Value
DoCmd.OpenQuery "Qry-SumIC", , acReadOnly
End Sub
which clearly defines the varibles to go into the query and runs the query, but now I need to output from the query to become fnICcheck so I can write the message box if the value returned isn't 100%.
No idea where to go from here. Can anyone help?
Thanks
The query is:
SELECT [Tbl-InvCase].ProjectID, [Tbl-InvCase].Gateway, Sum([Tbl-InvCase].[IC%]) AS [SumOfIC%]
FROM [Tbl-InvCase]
GROUP BY [Tbl-InvCase].ProjectID, [Tbl-InvCase].Gateway
HAVING ((([Tbl-InvCase].ProjectID)=fnProjectID()) AND (([Tbl-InvCase].Gateway)=fnGateway100()));
The return that I need to make a variable is SumOfIC%. Variable has been defined as intICcheck.
The code I have on leaving the child form is:
Private Sub Sub_InvCase_Exit(Cancel As Integer)
putProjectID Me.ProjectID.Value
putGateway100 Me.Gateway.Value
DoCmd.OpenQuery "Qry-SumIC", , acReadOnly
End Sub
which clearly defines the varibles to go into the query and runs the query, but now I need to output from the query to become fnICcheck so I can write the message box if the value returned isn't 100%.
No idea where to go from here. Can anyone help?
Thanks