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!

Transferring Values in Unbound Text box to Bound Text Box 1

Status
Not open for further replies.

STRATMAN1

Programmer
Jun 17, 2004
19
US
I have several calculated controls on a form (based on the controll source property being a dlookup function )that I want to have the values captured in a database so they can be sorted. I created a bound control text box, and in the corresponding unbound control text box I wrote an event procedure AFTER UPDATE as follows:

Me!txtunbound=Me!txtbound

so to speak

cant seem to capture the value in the bound text box. The bound textbox is in a main table and the form is bound on a query based on the fields in that table.

Still not working, all help appreciated! Thanks.
 
The after update event of a control fires after manually entering data into it. It doesn't fire when a calculated control calculates. You'd probably need to put it into another event (forms on current, before update???) appropriate to your requirements.

BTW - storing calculated values is breaking some of the "rules" of relational databases, and should only be done if you know exactly what you're doing and have a very good reason, else this is going to create future headaches. Much better to calculate the values every time you need them.

Roy-Vidar
 
worth trying some message boxes to make sure that your values are what you think they are:

msgBox Me!txtbound.Value
Me!txtunbound.Value=Me!txtbound.Value
msgbox Me!txtunbound.Value

Chris
 
I would suggest doing away with the unbound controls and putting a procedure in the oncurrent event of the form to calculate the values, assign them to variables, and then push them straight into the bound controls.
 
MrTBC,
Can you give me an example of how you would do this assuming the calculated values are:
[SellPrice]=([Cost]*[Markup])+ [Cost]
[125.00]=([100.00]*[.25])+ [100.00]
I get this to work on my form bound to Expr1([Cost]*[Markup]+[Cost])in the Query but cannot get this value to automatically enter into or update [SellPrice].In other words I want the user to enter the [Cost] and [Markup] values then have the calculated value automatically entered in the [SellPrice] field.
 
Why storing a calculated value in the table as you know how to retrieve it in a query ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,
I want to store this value in the table so it is like a (Hard copy) that I can use in other querys, forms, or reports.
W.
 
So that it sooner or later (most probably sooner) get's out of sync with the fields/values it is derived from giving "multiple versions of the thruth" (most of them just slightly off, some far off)?

Normalisation isn't just something thrown at developers to create a hard time, quite the contrary, when following those "rules", life get's much simpler, one doesn't have to skip the pub to do some tedious updating one can't perform during busieness hours because there are users on the system...

- but just follow the procedures outlined by STRATMAN1 and chirpyform, you should be able to do the "forbidden" thing, provided the field in question isn't calculated in the query, but an ordinary field;-)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top