Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update a field from another field

Status
Not open for further replies.

irethedo

Technical User
Feb 8, 2005
429
0
0
US
I have a form with a field that is in a table which I have locked so that the user can not change the value of this field but I want to set this up so the user can add a value to a 2nd field which will be added to the first field and update the table value- I want the 2nd field to default to zero and be set to 0 when its value is added to the 1st field.

This is pretty simple so far but I also want to add the contents of the 2nd field to the 1st field when someone changes the record or exits the form.

To complicate things a little bit, this form also has a button to print a report in which I would like to have the 2nd field update the 1st field and be set to 0 if the print button is checked.

Also, the data entered into the 2nd field can only be a number...

What event(s) do I use to accomplish this and what other code might i need to make it happen?

thanks
 
Use the second fields afterupdate event. This event fires after the value is changed. Just set field1's value and set field2 = 0. Set field2's validate test isNumeric.
 
This will do the job

Field 2 = me.Filed1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top