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

copy calc text box value to a field

Status
Not open for further replies.

MarkRCC

IS-IT--Management
Apr 26, 2001
167
CA
Hi.

I know it's a bit of a taboo to save the value(s) of calculated ,unbound text boxes but I find it necessary to do so.

I used the "AfterUpdate" property in the calculated text box to copy the value to the field in my table.

What would be the proper syntax as nothing is being saved.

Many TIAs

Mark
 
Have a look at the macros, there's a Setvalue option you can use to do just that



Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Here is a sample syntax to populate the field from a text box:
Me.FieldName = Me.TextBox

You would of course put the actual name of the field and textbox after the Me. When you type Me., the list of items will come up and you can select it.
 
Hi.

Thanks for the rapid response.

Neither suggestion is working, but I think it's a syntax thing.

nberryman: I tried creating a macro in the "After Update" property with the "Set Value" function with the following:
item: [tblname]![tblfield] (table/field where the
calculated value is to
be placed)

Expression: [Forms]![Subform name]![Calc txt box name]

No error messages but nothing being saved in the table.

sxschech: I have a CASE statement in the "After Update" property of a bound box (Company Name), that runs numerous formulas to populate 4 calculated text boxes. I attempted to add the line, "Me.FieldName = Me.TextBox" (no quotes). The problem is that "FieldName" is NOT on the list of available fields. "FieldName_Label" DOES show up though. "FieldName" is in the field list for the suboform.

Any ideas what I may be missing?

Again, many TIAs

Mark


 
I have tried my code in both Ac97 and 2000 and it works. Perhaps you didn't notice my explanation after the code...

"You would of course put the actual name of the field and textbox after the Me. When you type Me., the list of items will come up and you can select it."

Therefore if I understand the field names from your response the syntax would be (also didn't realize you had a subform). Also, this assumes that the forms are bound to the table:

Me.[Company Name]= Me.[Subform name]![Calc txt box name]
 
Bound your textbox to the field that coincides with it. Then put this code in the after update of the last control that holds part of the equation for the calculated field:

Me![NameofControlGettingResultsOfCalculation] = Me![CalculationControlNamePart1] +-*/ Me![CalculationControlNamePart2]

Now all you have to do is on the right side of the equal sign adjust the control names and operator to your control names and equation.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top