How do I bind a control on a form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having to calculate the number of times certain values appear on a form.
These values are later used as the basis for reports.
I can calculate the value using a function in the Control Source. How do I
move that value to a table?
 
You cannot do it the way you're trying to do it because you can't have a
calculation as the control source and also have the control bound to a field
in the database.

What you have to do instead is write some code in an event to do the
calculation and place the result into the control. The control itself would
be bound to the field in the database.

For example, you might put your code in the BeforeUpdate event for the form.
Assuming that txbResult is where you want to store the result of the
calculation, and assuming that the control source for txbResult is the
appropriate field in the underlying table or query, then your BeforeUpdate
event would read

me.txbResult = {calculation}

where {calculation} is the VB code to do whatever calculations you need to
do.
 
Back
Top