Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: Calculated Default Value

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Calculated Default Value
Ian 30.09.2006 20:29:01
I'm making an estimate sheet and want to create a default value that is based
on other form/table values.
I know I should just do a query calc and not store the total but I can't
trust the salespeople to do the math properly and ultimately we have to stick
by the price so I have to store 3 values. The math is simple: HorzFt x
HorzPrice = HorzTot when I tab/click over to the HorzTot field on the form I
want it to calcuate the default total (but I still want to be able to change
it if necessary).

I went to the properties area of the TextBox for HorzTot and under default
value put =[horzft]*[horzprice] but nothing happens. Any ideas?
Re: Calculated Default Value
Steve Schapel <schapel[ at ]mvps.org.ns> 01.10.2006 02:25:04
Ian,

The Default Value property of a control only applies at the point where
a new record is being first created. So by the time you have data
already in the HorzFt and HorzPrice fields, it's way too late.

Here's an idea... On the Enter event of the HorzTot control, put code
like this...

If IsNull(Me.HorzTot) then
Me.HorzTot = Me.HorzFt * Me.HorzPrice
End If

By the way, your argument for the need to store this calculated value is
not convincing.

--
Steve Schapel, Microsoft Access MVP

Ian wrote:
[Quoted Text]
> I'm making an estimate sheet and want to create a default value that is based
> on other form/table values.
> I know I should just do a query calc and not store the total but I can't
> trust the salespeople to do the math properly and ultimately we have to stick
> by the price so I have to store 3 values. The math is simple: HorzFt x
> HorzPrice = HorzTot when I tab/click over to the HorzTot field on the form I
> want it to calcuate the default total (but I still want to be able to change
> it if necessary).
>
> I went to the properties area of the TextBox for HorzTot and under default
> value put =[horzft]*[horzprice] but nothing happens. Any ideas?

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net