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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Result of Calculated Text box on a form into the Database 1

Status
Not open for further replies.

STRATMAN1

Programmer
Jun 17, 2004
19
US
I have created a form with bound textbox controls where certain values are typed in. I have a corresponding unbound textbox with a DLookup statement typed in the Control Source Property that matches the typed value in the bound control to a table of range values. I am trying to get my calculated results into a database table, but realize I cant do that without them being in a bound control to the form record source. I have read in a textbook that I should perform my calculation in a VBA procedure instead of using the Control source property and then "push" the result of the calculation into a bound control using another VBA procedure. Cant find the code or property affected in the control to do either one. Would appreciate any code or guidance on how to accomplish this. Thanks in advance!!!
 
How are ya STRATMAN1 . . . .

You already have it. The same procedure performing the calculation is used to write to the bound control. The only problem is when & how to call/run the routine. More often, it'll be done with some event procdeure when another control is updated.

If I have a bound control(Tax) whose value is dependant on the control(Amount), and the %Tax is .0825, in the [blue]AfterUpdate Event[/blue] of Amount you would have:

Me!Tax = .0825 * Me!Amount

Calvin.gif
See Ya! . . . . . .
 
...Another apporach

The bound form is going to pickup whatever value is in the table, if present.

Do you want to over-write the data? If so, when? Always?

Where I am going with this is usually, you do not need to store calculated fields in a table since you can calculate the value at anytime.

See the following post on a similar topic...

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top