Event Procedure not working

  • Thread starter Thread starter sonofroy
  • Start date Start date
S

sonofroy

I have a form with 2 fields

Amount1
Amount2

What I am trying to accomplish is when you fill in Amount1, Amount 2 will
automatically be 80% of the value of amount1

My code for Amount2 is =[Amount1]*.8

every event I have tried has produced nothing for Amount2. Any ideas where I
should put this to get Amount2 code to work? Thanks
 
sonofroy said:
I have a form with 2 fields

Amount1
Amount2

What I am trying to accomplish is when you fill in Amount1, Amount 2 will
automatically be 80% of the value of amount1

My code for Amount2 is =[Amount1]*.8

every event I have tried has produced nothing for Amount2. Any ideas where
I
should put this to get Amount2 code to work? Thanks

You should calculate this value in a query. You should not store
calculations.

Keith.
www.keithwilby.co.uk
 
SonOfRoy -

Put your code in the BeforeUpdate event of Amount1. The code should be
Me.Amount2 is =Me.Amount1*.8
 
That did not work it did not reutrn anything


Daryl S said:
SonOfRoy -

Put your code in the BeforeUpdate event of Amount1. The code should be
Me.Amount2 is =Me.Amount1*.8
--
Daryl S


sonofroy said:
I have a form with 2 fields

Amount1
Amount2

What I am trying to accomplish is when you fill in Amount1, Amount 2 will
automatically be 80% of the value of amount1

My code for Amount2 is =[Amount1]*.8

every event I have tried has produced nothing for Amount2. Any ideas where I
should put this to get Amount2 code to work? Thanks
 
Ok but then how do I return this value to the forms table?

Keith Wilby said:
sonofroy said:
I have a form with 2 fields

Amount1
Amount2

What I am trying to accomplish is when you fill in Amount1, Amount 2 will
automatically be 80% of the value of amount1

My code for Amount2 is =[Amount1]*.8

every event I have tried has produced nothing for Amount2. Any ideas where
I
should put this to get Amount2 code to work? Thanks

You should calculate this value in a query. You should not store
calculations.

Keith.
www.keithwilby.co.uk

.
 
sonofroy said:
Ok but then how do I return this value to the forms table?

A form can be bound to a query as well as a table. Create a query
containing the calculated field and bind your form to it. You *do not*
store the value in any table, it is calculated evry time the query is run.

Keith.
www.keithwilby.co.uk
 
You've been advised about not storing a calculated value. However, you don't
say anything about whether or not the Amount2 control is bound, so it could
be you just want to do a Calculated Control. In that case, you could set the
Control Source for Amount2 to =Amount1*.8, and in the AfterUpdate event of
the Amount1 control, use Me.Amount2.Requery.

Larry Linson
Microsoft Office Access MVP
 
Back
Top