Simple Problem

  • Thread starter Fakhruddin Zavery
  • Start date
F

Fakhruddin Zavery

Hello,

I have created a very simple table with two fields F1 and F2 both being
Number types. My aim is to have a form that takes F1 as any Value and Puts
20% of it on F2. Yes I just put a formula for the field on the form for F2
under control source as = [F1] * 0.2

The value shows up correctly on the form but when i close the form and check
the table onlty F1 value gets saved and F2 is empty. Is there something I
have to do to make it save?

Will appreciate all the help

Thanks and Regards
 
M

Martin Scott

Firstly if your field F2 is always 20% why do you need a field to store it
in?

So if you do need to store the value then for F2 you need the control source
for F2 as the field in the table so it has somewhere to store the data.

Then in the properties for F1 look at events and select after update. There
will be a small button on the side of this. Click here to see the code
window. In the code window type
me.F2 = me.F1 * 0.2

so it looks like this when your done.

Private Sub F1_AfterUpdate()

Me.F2 = Me.F1 * 0.2

End Sub


M.
 
J

Jeff Boyce

Don't! If you need to know 20% of the value in Field1, use a query. Takes
less storage and runs faster than a table lookup.

Otherwise, you'll have to work out all the synchronization to handle when
someone changes a value in Field1, or types over the value in Field2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top