Updating a text box from another text box

not_rich_yet

Registered User.
Local time
Today, 23:36
Joined
Mar 19, 2002
Messages
39
OK, I have a text box linked to a combo box on my form. When I choose a product from the combo box, the text box displays the price of the product.

Which is good.

Thing is, I actually want the text box value pulled from the combo to be bound to a data field of a record in a seperate table. The text box has to be bound to the combo (which pulls it's data from a query) otherwise it obviously(?) doesn't update every time I select a new product form the combo.

I tried creating a new text box, bound to the data field, and then making it's default value to be that displayed in the combo-box textbox, but all it does is display whatever value is held in the field froim the TABLE. It refuses to display the value from the combo-box textbox...

This is the last bit I am working on before I can progress with this database...been annoying me for over a day now!

Any suggestions are most welcome! Be them VBA or Access based...

nry
 
Rather than binding the textbox to the combo, bind it to your field then try the following code to update the textbox. In the AfterUpdate Event of the ComboBox

Sub ComboBox_AfterUpdate()
Me.NameOfTextbox = Me.NameOfCombo.Column(ColumnWherePriceIs)'remember that the combo is zero indexed
End Sub

HTH
 
Superb! I looked at the VBA bits for the text box but never thought of using code for the update property of the combo box!

Works a treat! Thanks again!

nry
 
Sir

i am also doing as
one textbox named (PAN)
PAN value updated on a combo box
i want to update value of another textbox named(DOB) on change or update value of text box (PAN)
how can i do it
source of textbox PAN and DOB in same table named(Allname)

pls give m solution
 

Users who are viewing this thread

Back
Top Bottom