Copy text box value to master table

fraser_lindsay

Access wannabe
Local time
Today, 17:40
Joined
Sep 7, 2005
Messages
218
I have read a few posts about this but none have really told me how to achieve what I want.

I have form with lots of information based on a master table. One on tab control I have setup a number of unbound text boxes with IIf expressions, these return values. These values are summed and another unbound text box creates another value - "Risk" i.e. High, Moderate or Low.

These are all unbound text boxes and the values are only there to run the expression to determine risk. This is the value I want stored in my master table. I have created a text field in my master table but I want the form to be able to take the risk value form teh unbound text box and drop that into the table under "Risk".

This will be unique for each master record on this form and will change depending on changes in parameters selected within the table.

Is there a simple expression to do this?
 
hmmm, simpler than I was making it.

After some trial and error my extremely simple solution was:

In the tab control properties 'On Change' event

Me.txtRisk = Me.Risk2.value

That just copies the value form my unbound text box into the input text box of teh field risk, bound to the table. Then I locked it so it can't be tampered with and gets it's input from the now hidden text box.
 
ok i know this is an old post but i am trying to do the same and its not working.. does anyone have any ideas? thanks! Summer
 
Summer, please read this sentence.
These are all unbound text boxes and the values are only there to run the expression to determine risk.
This is what you should only do, calculate the value on-the-fly. You don't save calculated values.
 
right but i am trying to do the same, i have a calculated value in an unbound text field and trying to copy that value to the bound text box that is bound to the master table... isnt that what fraser_lindsay trying to do?

"Me.txtRisk = Me.Risk2.value

That just copies the value form my unbound text box into the input text box of teh field risk, bound to the table. Then I locked it so it can't be tampered with and gets it's input from the now hidden text box."
 
...right but i am trying to do the same, i have a calculated value in an unbound text field and trying to copy that value to the bound text box that is bound to the master table... isnt that what fraser_lindsay trying to do?
Yes, that is what fraser_lindsay was trying to do, but as vbaInet said:

...you should only... calculate the value on-the-fly. You don't save calculated values!
Situations that require storing of Calculated Values are few and far between, and this doesn't appear to be one of those situation!

Re-calculating your Values, on-the-fly, will always be quicker than retrieving the Value from a Table, and helps to insure that the component values used for the calculation are up to date.

Linq ;0)>
 
thanks! but what does "calculating the value on-the-fly" mean?
 
Using a query to calculate and return the values whenever you need it. A bit like on-demand ;)
 
thank you both! But i have a table where i am grabing the information i need (i/e hours) and basically need to update the master table to capture these hours so that htey are stored. So basically i am not calculating anything... why is it that i still cant copy it? I have an unbound text field- PH1NV, that has "=[Combo1].[column](2)" which captures the hours fromt he query i created off of the hours table.. so it displays the hours.. now i want to take these and put it in a bound textbox - PH1MSTR to the master table (Field in master table is ph1) so that its captured. Would the code above be under the change event of the PH1MSTR

Private Sub PH1MSTR_Change()
Me.PH1MSTR = Me.PH1NV.Value
End Sub
 
ok so maybe i am missing to tell u something, i have a combo box where i select a value depending on that, my unbound text box is populated with a value (using a query to pull down the value from a different table), then i want to take that value from the unbound text box and copy it to a bound text box. I have searched eevrywhere and this is what i am trying in my unbound text box (PH1NV) in the AfterUpdate event i have the following code, my bound textbox is called PH1, so it would be BoundField.value = UnBoundField.value

Private Sub PH1NV_AfterUpdate()
PH1.Value = PH1NV.Value
End Sub

but it still doesnt work... why????????????????????????? :(
 
this is going to sound so DUMB and it took me few days to figure this out... but i all i had to do was put that code in the AfterUpdate event of the combobox and not the unbound textbox... URGH..... but i am now :)
 

Users who are viewing this thread

Back
Top Bottom