Table name in Expression builder not allowed?

  • Follow


I tried to do a simple calculation (on a form) but fail to understand this:
=[UnitPrice]*[Quantity]      works, however if I use the Tables list from
(below) and construct the formula it shows as:
[OrderDetails].UnitPrice * [OrderDetails].Quantity
and it does not work. I get #Name error
When field names are written as [UnitPrice] is it not a standard practice to
name them as such? Somewhere I also see [OrderDetails]![UnitPrice] notation.
Why? Thanks


1
Reply dindigul 10/17/2007 9:34:37 PM

"dindigul" <padhye.m@gmail.com> wrote in
news:O9MdHWQEIHA.5752@TK2MSFTNGP02.phx.gbl: 

> I tried to do a simple calculation (on a form) but fail to
> understand this: =[UnitPrice]*[Quantity]      works, however if I
> use the Tables list from (below) and construct the formula it
> shows as: [OrderDetails].UnitPrice * [OrderDetails].Quantity
> and it does not work. I get #Name error
> When field names are written as [UnitPrice] is it not a standard
> practice to name them as such? Somewhere I also see
> [OrderDetails]![UnitPrice] notation. Why? Thanks
> 
You are on a form, not in a query. The notation [Table].[field] will 
be required in a query that joins two or more tables where the same 
field name appears  more than once.

The use of the bang {!} or the dot {.} is dependent whether you are 
using VBA to refer to a query in SQL or a recordset in VBA. 



-- 
Bob Quintal

PA is y I've altered my email address.

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Reply Bob 10/17/2007 9:29:26 PM


dindigul wrote:
> I tried to do a simple calculation (on a form) but fail to understand this:
> =[UnitPrice]*[Quantity]      works, however if I use the Tables list from
> (below) and construct the formula it shows as:
> [OrderDetails].UnitPrice * [OrderDetails].Quantity
> and it does not work. I get #Name error
> When field names are written as [UnitPrice] is it not a standard practice to
> name them as such? Somewhere I also see [OrderDetails]![UnitPrice] notation.
> Why? Thanks

You are on a form, not in a query, that's why. The notation [Table].
[field] will be required in a query that joins two or more tables
where the same field name appears  more than once.

The use of the bang {!} or the dot {.} is dependent whether you are
using VBA to refer to a query in SQL or a recordset in VBA.



--
Bob Quintal

0
Reply rquintal 10/18/2007 4:08:18 AM

2 Replies
488 Views

(page loaded in 0.026 seconds)


Reply: