N
Nick
Yes, that's right, I have created a NULL query!
OK, to explain. I am developing a form of Financial Management database for
my organisation. The database manages information for projects, purchase
orders (or contracts) against projects and project budget variations (as well
as other things). Everything seems to be fine at the moment - however, I have
a problem with NULL fields.
There are two tables that are related - the Project Information Table and
the Project Variation Table. This is a One to Many Relationship. Essentially,
personnel enter the initial project information into the PROJECT INFORMATION
TABLE and, as the projects continue, they enter any project budget variations
to the PROJECT VARIATION TABLE.
The PROJECT INFORMATION TABLE includes the intial budget. That is all. This
is kept to ensure that datamining and future estimations can be conducted. As
such, I can not use an Update Query to change the Budget Amount in the
PROJECT INFORMATION TABLE. The project's are numbered under [Project Number]
in this table.
So, the PROJECT VARIATION TABLE was created. This is the [Project Number] (a
drop down list of all the project numbers in the PROJECT INFORMATION TABLE)
and the variation amount - [Variation] - as well as other management
information.
A Sum Query - VARIATION TOTAL QUERY - is used to sum the total of variations
for all projects, by [Project Number]. The sum is obviously called
[SumofVariation]
Another query - TOTAL QUERY - then calculates the current total of all
projects. This lists the [Project Number] from the PROJECT INFORMATION TABLE,
the [Initial Budget] from the PROJECT INFORMATION TABLE and the
[SumofVariation] from the VARIATION TOTAL QUERY. It then adds [Initial
Budget] + [SumofVariation] to create [Current Budget].
PROBLEM: If you have no variations for a project, then the VARIATION TOTAL
QUERY returns nothing. Therefore, [SumofVariation] is NULL and then [Current
Budget] is NULL. When you view the TOTAL QUERY in datashet view you see
nothing, because there is nothing in the VARIATION TOTAL QUERY.
So - how do I make the TOTAL QUERY spit out the initial budget where
VARIATION TOTAL QUERY is NULL (ie, no variations have occured).
I have tried to use an iif statement in the following:
iif ( IsNull([SumofVariation]),0,[SumofVariation]) *tables obmitted*
No joy with that, it still spat out NULL.
Then tried:
Nz([SumofVariation],0)
Still no good.
The problem seems to be the fact that the VARIATIONS TOTAL QUERY is NULL.
Any help would be great - Cheers!
OK, to explain. I am developing a form of Financial Management database for
my organisation. The database manages information for projects, purchase
orders (or contracts) against projects and project budget variations (as well
as other things). Everything seems to be fine at the moment - however, I have
a problem with NULL fields.
There are two tables that are related - the Project Information Table and
the Project Variation Table. This is a One to Many Relationship. Essentially,
personnel enter the initial project information into the PROJECT INFORMATION
TABLE and, as the projects continue, they enter any project budget variations
to the PROJECT VARIATION TABLE.
The PROJECT INFORMATION TABLE includes the intial budget. That is all. This
is kept to ensure that datamining and future estimations can be conducted. As
such, I can not use an Update Query to change the Budget Amount in the
PROJECT INFORMATION TABLE. The project's are numbered under [Project Number]
in this table.
So, the PROJECT VARIATION TABLE was created. This is the [Project Number] (a
drop down list of all the project numbers in the PROJECT INFORMATION TABLE)
and the variation amount - [Variation] - as well as other management
information.
A Sum Query - VARIATION TOTAL QUERY - is used to sum the total of variations
for all projects, by [Project Number]. The sum is obviously called
[SumofVariation]
Another query - TOTAL QUERY - then calculates the current total of all
projects. This lists the [Project Number] from the PROJECT INFORMATION TABLE,
the [Initial Budget] from the PROJECT INFORMATION TABLE and the
[SumofVariation] from the VARIATION TOTAL QUERY. It then adds [Initial
Budget] + [SumofVariation] to create [Current Budget].
PROBLEM: If you have no variations for a project, then the VARIATION TOTAL
QUERY returns nothing. Therefore, [SumofVariation] is NULL and then [Current
Budget] is NULL. When you view the TOTAL QUERY in datashet view you see
nothing, because there is nothing in the VARIATION TOTAL QUERY.
So - how do I make the TOTAL QUERY spit out the initial budget where
VARIATION TOTAL QUERY is NULL (ie, no variations have occured).
I have tried to use an iif statement in the following:
iif ( IsNull([SumofVariation]),0,[SumofVariation]) *tables obmitted*
No joy with that, it still spat out NULL.
Then tried:
Nz([SumofVariation],0)
Still no good.
The problem seems to be the fact that the VARIATIONS TOTAL QUERY is NULL.
Any help would be great - Cheers!