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

Access not regognize field value change when its calculated by VB

P: n/a
Hi

Is there any good ideas how to update form vb code always after some values
are changed / added by vb (not user).

I have some code behind subforms vb and there are calculations behind
"Form_Current" section those I need to re-calculate after some values are
changed or added.

The problem is that if list box value is calculated in vb, access wont
regognize that valua has changed.

Simple example:
There are 4 "list box" objects in the form.
- user_input_box_01
- user_input_box_02
- vb_calculated_box_01
- sum_of_user_input_and_vb_calculated_01

**This code is behind every 4 objects**
Private Sub <some_of_those_4_objects>_AfterUpdate()
Form_Current
End Sub

**This code is behind form_current**
Dim var_user_input_box_01, var_user_input_box_02
var_user_input_box_01 = Me.user_input_box_01.Value
var_user_input_box_02 = Me.user_input_box_02.Value

Me.vb_calculated_box_01.Value = var_user_input_box_01 +
var_user_input_box_02

Dim var_vb_calculated_box_01
var_vb_calculated_box_01 = me.vb_calculated_box_01
me.sum_of_user_input_and_vb_calculated_01.value = var_user_input_box_01 +
var_vb_calculated_box_01

**End of code behind form_current**
How it works:
User gives values in "user_input_box_01" and "user_input_box_02"
After "user_input_box_02" value is entered "vb_calculated_box_01" value is
calculated correctly, but.... "sum_of_user_input_and_vb_calculated_01" is
empty.

When I click to "vb_calculated_box_01" or
"sum_of_user_input_and_vb_calculated_01" box -->
"sum_of_user_input_and_vb_calculated_01" value is calculated correctly.

Also if I change user values, "vb_calculated_box_01" value is calculated
correctly, but.... "sum_of_user_input_and_vb_calculated_01" is calculated by
previous user values until I click "vb_calculated_box_01" or
"sum_of_user_input_and_vb_calculated_01"..
How it should works:
Some code or etc. function that I donīt need always to click those boxes
would be very nice =)
Regards,
Henry
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.