D
David McKnight
I would like to have an input field in a form that would set the criteria for
a query.
Say on the query below I have the form update [table5] so that [name] field
= "A".
This does not work as I have written as I get an error
"The specified field [name] could could refer to more than one table in the
FROM clause in your SQL statement."
but I'm not sure why .
SELECT Table1.Year, Table1.Name, (DAvg("[Value]","Table1","Name='" & [Name]
& "' AND Year BETWEEN " & [Year]-7 & " AND " & [Year]+0)) AS [Moving Avg
Value], ((DAvg("[Value]","Table1","Name='" & [Name] & "' AND Year BETWEEN " &
[Year]-7 & " AND " & [Year]-1))+(DAvg("[Value]","Table1","Name='" & [Name] &
"' AND Year BETWEEN " & [Year]-5 & " AND " &
[Year]-1))+(DAvg("[Value]","Table1","Name='" & [Name] & "' AND Year BETWEEN "
& [Year]-3 & " AND " & [Year]-1)))/3 AS [Wt Moving Avg Value]
FROM Table5 INNER JOIN Table1 ON Table5.Name = Table1.Name;
a query.
Say on the query below I have the form update [table5] so that [name] field
= "A".
This does not work as I have written as I get an error
"The specified field [name] could could refer to more than one table in the
FROM clause in your SQL statement."
but I'm not sure why .
SELECT Table1.Year, Table1.Name, (DAvg("[Value]","Table1","Name='" & [Name]
& "' AND Year BETWEEN " & [Year]-7 & " AND " & [Year]+0)) AS [Moving Avg
Value], ((DAvg("[Value]","Table1","Name='" & [Name] & "' AND Year BETWEEN " &
[Year]-7 & " AND " & [Year]-1))+(DAvg("[Value]","Table1","Name='" & [Name] &
"' AND Year BETWEEN " & [Year]-5 & " AND " &
[Year]-1))+(DAvg("[Value]","Table1","Name='" & [Name] & "' AND Year BETWEEN "
& [Year]-3 & " AND " & [Year]-1)))/3 AS [Wt Moving Avg Value]
FROM Table5 INNER JOIN Table1 ON Table5.Name = Table1.Name;