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

Update a texbox from another textbox using vba

Status
Not open for further replies.

oxicottin

Programmer
Jun 20, 2008
353
0
0
US
Hello, I have a form that has a formula and this text box is hidden and named txtAutoHeld with a formula;

Code:
=IIf([cboProductID].[Column](1)="SLOC NOS",Round([cboProductLength].[Column](3)*25/12),IIf([cboProductLength].[Column](3)=1200,1000,IIf([cboProductLength].[Column](3)=300,600,Round([cboProductLength].[Column](3)*50/12))))*[txtCartonsHeld]

Next im using this formula to save or capture the value to the table in a text box named txtLinearFT which works fine using;

Code:
Me.txtLinearFT = Me.txtAutoHeld

Now the problem is the value changes in the text box txtAutoHeld lets say when I click on a text box named txt1 but the value doesnt change in the textbox txtLinearFT UNLESS I requery the form which I cant because I have validation in the forms before update that uses the controls tags and the ones that are blank it gives a list of controls that are blank. Is there another way to do this?

Thanks,
SoggyCashew.....
 
Where are you calling the code "to save or capture the value to the table"? Why are you storing a value that can be calculated? Why not just display txtAutoHeld?

I never create a long expression with nested IIf()s. I would use a small user-defined function that is saved in a module named "modBusinessCalcs". This is particularly true since you have all of the (9) hard-coded values.



Duane
Hook'D on Access
MS Access MVP
 
@dhookom you got me thinking, your right why am I saving this value to a table when it can be calculated and displayed.... I been over thinking this! Thanks for bringing me back!

Thanks,
SoggyCashew.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top