Re: Using a form to set criteria for a query
- From: "Jeff Boyce" <JeffBoyce_IF@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jan 2006 07:09:42 -0800
David
When I get that (kind of) error message, it means my query has more than one
table with a field named [Name]. You may need to preface your [Name] field
something like [Table].[Name].
Caution! Access treats the word "name" as a reserved word. By using this
as your field name, you are confusing both Access and yourself. Consider
changing that field name to something else, like:
CustomerName
--
Regards
Jeff Boyce
<Office/Access MVP>
"David McKnight" <DavidMcKnight@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54E1117A-F6C2-4452-B914-3F846957A8BE@xxxxxxxxxxxxxxxx
> 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;
>
> --
> David McKnight
.
- Follow-Ups:
- Re: Using a form to set criteria for a query
- From: David McKnight
- Re: Using a form to set criteria for a query
- Prev by Date: Re: Using a form to set criteria for a query
- Next by Date: Error 3061
- Previous by thread: Re: Using a form to set criteria for a query
- Next by thread: Re: Using a form to set criteria for a query
- Index(es):
Relevant Pages
|