By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,557 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,557 IT Pros & Developers. It's quick & easy.

How to update the field in MS Access

P: 4
Hi friends,

I am new to MS Access. I have desiged a Form wherein I would like to update the field based on some calculation derived from the previous fields. How this can be done.
I want to update/write into the table against Tax field the value that was calculated based on the field 'Gross'.
Example, Gross * .02, the resulted value will be displayed against Tax field and the same amount need to be updated into the table against Tax field.

What is the procedure to followed for achieving this?

Please help me in this regard.
Thank u

RMR
Aug 7 '06 #1
Share this Question
Share on Google+
4 Replies


P: 16
so in your table you have a field called GROSS and a field called TAX correct?

If that is the case, on the properties for the TAX field in the gotfocus area put the following in the code for the form:

Private Sub tax_GotFocus()
tax.Value = Gross.Value * 0.02
End Sub

If you make the properties for the tax field locked (again in the field properties for TAX and change the setting for LOCKED from no to yes) you will ensure that you don't put any data in that field which can sometimes happen when you press the TAB key doing fast input.

--Beat
Aug 7 '06 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
You could also try, on the properties for the GROSS field in the AfterUpdate area put the following in the code for the form:

Private Sub Gross_AfterUpdate()
Me.tax = Me.Gross * 0.02
End Sub
Aug 8 '06 #3

P: 4
Thanks for immediate response. As suggested, I would try and get back to you if I face any other problems.

Thanks once again.

RMR




so in your table you have a field called GROSS and a field called TAX correct?

If that is the case, on the properties for the TAX field in the gotfocus area put the following in the code for the form:

Private Sub tax_GotFocus()
tax.Value = Gross.Value * 0.02
End Sub

If you make the properties for the tax field locked (again in the field properties for TAX and change the setting for LOCKED from no to yes) you will ensure that you don't put any data in that field which can sometimes happen when you press the TAB key doing fast input.

--Beat
Aug 8 '06 #4

P: 4
Thanks for immediate response. As suggested, I would try and get back to you if I face any other problems.

Thanks once again.

RMR


You could also try, on the properties for the GROSS field in the AfterUpdate area put the following in the code for the form:

Private Sub Gross_AfterUpdate()
Me.tax = Me.Gross * 0.02
End Sub
Aug 8 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.