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

update default value of textbox based on another textbox in same form 1

Status
Not open for further replies.

lanelouna

Programmer
Dec 19, 2002
71
GB
How can I REcalculate the display value (the default value) of a textbox based on an input in another textbox.
lets say

I have text box called: investInfraSysTr04

when I modify its value, I want the value of second textbox: investInfraSysTrAvecMarge07 to change (the default value is always equal to =[Formulaires]![Formulairesc01]![investInfraSysTr04]*2)

I tried to use this code, but it didn't work
after update:
Private Sub investInfraSysTr04_AfterUpdate()
Me![investInfraSysTr04].Requery
Me.Refresh
End Sub


can anyone help please?
thank you in advance.

Lina
 
is investInfraSysTrAvecMarge07 a bound control? if so, it's not just going to change. Is =[Formulaires]![Formulairesc01]![investInfraSysTr04]*2) the "DEFAULT VALUE" or the CONTROL SOURCE?

If you are trying to save a new value to a field in a table, then you have to do something like

Private Sub investInfraSysTr04_AfterUpdate()
Me![investInfraSysTr04] = Blah
End Sub

Requery doesn't make the 'default value' save itself into a field. "Default Value" is only what the value of the field is going to be when you add a new record.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
I do not know how to create a bound or not control.
the
=[Formulaires]![Formulairesc01]![investInfraSysTr04]*2) is the "DEFAULT VALUE"
I am sorry it is my fault
I was all the time trying to use the default value!!
it worked when i used the control source
thanks for your questions! and your explanations
Lina
 
Bound" means that the contol (text box, combo box, etc) is 'bound' to a table field. There'd be a field name in the Control Source.

"Unbound" means that the control is not bound to anything, it's just a dead control sitting there for you to put whatever you want in it. The Control Source will not be the name of a table field.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top