ThomasFoege
asked on
Simple Access IF query when no join on tables?
Hello EE!
I'm having a few problems with a query that I do
I have three tables that is used in a simple weight loss programme
My table is "Names" and contains a long list of people names and their starting weight , "HalfWayWeight" contains a list of names with their corresponding mid way weight and "EndWeight" contains a list of people names and their corresponding end weight.
My query takes the Names table and then joins midway and end weights. However, sometimes there are no mid or end weight listed. What I'm trying to do is the following:
Get a query that gives the following:
Name, StartWeight, MidwayWeight, EndWeight and gives a 0 if it's missing. So far I've been trying this:
StartWeight: [Names].[Weight]
MidwayWeight: IIf([HalfWayWeight].[Weigh t]>0;[Half WayWeight] .[Weight]] ;0)
However, this does not work. It does not seem to check if "[HalfWayWeight].[Weight]" is greater than zero if that person is not represented in the MidwayWeight table?
I hope one of you out there have a suggestion on how to do these queries!
Thanks in advance!
I'm having a few problems with a query that I do
I have three tables that is used in a simple weight loss programme
My table is "Names" and contains a long list of people names and their starting weight , "HalfWayWeight" contains a list of names with their corresponding mid way weight and "EndWeight" contains a list of people names and their corresponding end weight.
My query takes the Names table and then joins midway and end weights. However, sometimes there are no mid or end weight listed. What I'm trying to do is the following:
Get a query that gives the following:
Name, StartWeight, MidwayWeight, EndWeight and gives a 0 if it's missing. So far I've been trying this:
StartWeight: [Names].[Weight]
MidwayWeight: IIf([HalfWayWeight].[Weigh
However, this does not work. It does not seem to check if "[HalfWayWeight].[Weight]"
I hope one of you out there have a suggestion on how to do these queries!
Thanks in advance!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked!
If either of the halfway or end tables might not have a record that matches the start record then you must address that through the join type. Right click on the join line in the query design, and choose Join Type; then pick the option that gives you all Start table records.
As for the missing weights you can try...
MidwayWeight: NZ([HalfWayWeight].[Weight