G
Guest
I created a query where I did some calculations and then named the field
(example: pounds: tons*2000). All the fields I created like this cause a
"enter parameter value" prompt to appear. I read that this is because the
query is referencing something it doesn't recognize. How do I fix this? The
SQL statement is as follows:
SELECT tblCrates.Location, tblMaster.Month, tblCrates.[Number of Crates],
tblLactation.[Number of sows farrowed], tblLactation.[Number of litters
weaned], tblLactation.[Average age at weaning], tblMaster.Ingredient, [Number
of sows farrowed]*[Average age at weaning] AS [Lactation Days],
tblMaster.[Volume \ Tons], [Pounds]/[Lactation Days] AS [ADFI Per Lact Day],
([Number of sows farrowed]+[Number of litters weaned])/2 AS [Average Farrowed
and Weaned], tblLactation.[Days per month], [Days per month]*[Number of
Crates] AS [Crate Days], [Pounds]/[Crate Days] AS [ADFI crate days,lb],
([ADFI Per Lact Day]+[ADFI crate days,lb])/2 AS [ADFI,lb], [Volume \
Tons]*2000 AS Pounds, tblLactation.Year
FROM (tblCrates INNER JOIN tblMaster ON tblCrates.Location =
tblMaster.Location) INNER JOIN tblLactation ON (tblMaster.Month =
tblLactation.Month) AND (tblCrates.Location = tblLactation.Location)
GROUP BY tblCrates.Location, tblMaster.Month, tblCrates.[Number of Crates],
tblLactation.[Number of sows farrowed], tblLactation.[Number of litters
weaned], tblLactation.[Average age at weaning], tblMaster.Ingredient, [Number
of sows farrowed]*[Average age at weaning], tblMaster.[Volume \ Tons],
[Pounds]/[Lactation Days], ([Number of sows farrowed]+[Number of litters
weaned])/2, tblLactation.[Days per month], [Days per month]*[Number of
Crates], [Pounds]/[Crate Days], ([ADFI Per Lact Day]+[ADFI crate days,lb])/2,
[Volume \ Tons]*2000, tblLactation.Year
HAVING (((tblMaster.Ingredient)="Lactation" Or
(tblMaster.Ingredient)="gestation"));
Thank you for your help.
(example: pounds: tons*2000). All the fields I created like this cause a
"enter parameter value" prompt to appear. I read that this is because the
query is referencing something it doesn't recognize. How do I fix this? The
SQL statement is as follows:
SELECT tblCrates.Location, tblMaster.Month, tblCrates.[Number of Crates],
tblLactation.[Number of sows farrowed], tblLactation.[Number of litters
weaned], tblLactation.[Average age at weaning], tblMaster.Ingredient, [Number
of sows farrowed]*[Average age at weaning] AS [Lactation Days],
tblMaster.[Volume \ Tons], [Pounds]/[Lactation Days] AS [ADFI Per Lact Day],
([Number of sows farrowed]+[Number of litters weaned])/2 AS [Average Farrowed
and Weaned], tblLactation.[Days per month], [Days per month]*[Number of
Crates] AS [Crate Days], [Pounds]/[Crate Days] AS [ADFI crate days,lb],
([ADFI Per Lact Day]+[ADFI crate days,lb])/2 AS [ADFI,lb], [Volume \
Tons]*2000 AS Pounds, tblLactation.Year
FROM (tblCrates INNER JOIN tblMaster ON tblCrates.Location =
tblMaster.Location) INNER JOIN tblLactation ON (tblMaster.Month =
tblLactation.Month) AND (tblCrates.Location = tblLactation.Location)
GROUP BY tblCrates.Location, tblMaster.Month, tblCrates.[Number of Crates],
tblLactation.[Number of sows farrowed], tblLactation.[Number of litters
weaned], tblLactation.[Average age at weaning], tblMaster.Ingredient, [Number
of sows farrowed]*[Average age at weaning], tblMaster.[Volume \ Tons],
[Pounds]/[Lactation Days], ([Number of sows farrowed]+[Number of litters
weaned])/2, tblLactation.[Days per month], [Days per month]*[Number of
Crates], [Pounds]/[Crate Days], ([ADFI Per Lact Day]+[ADFI crate days,lb])/2,
[Volume \ Tons]*2000, tblLactation.Year
HAVING (((tblMaster.Ingredient)="Lactation" Or
(tblMaster.Ingredient)="gestation"));
Thank you for your help.