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!

write value to a textfield from a look up field

Status
Not open for further replies.

ooops

MIS
Dec 21, 2000
91
US
Hi,

I have a look up field on my form. Everytime the value of my look up field is changed, I'd like to write that value to a hidden textbox which tied to my table.
I tried: txtHidden = txtLookup on the onChanged event or afterUpdate event of the lookup field but it did not write anything to my txtHidden. Any reason why ? Thanks.
 
Taking a guess here, but I think that you mean a control on your form using one of the domain aggregate functions (DLookup, DCount...) as control source.

I don't think the after update and on change events fires when the control recalculates, so...

An idea:
In stead of using the domain aggregate function as control source, try binding it to the field where you want to store the value, then in some event, for instance the on current event of the form, assign the lookup to the control:

[tt]Me!txtSomeControl.Value = DLookup("blah","[more blah]", _
"somefield = '" & Me!SomeOtherTextBox.Value & "'")[/tt]

- should the criteria be another control on the form, you might consider dumping this into the after update event of that control too.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top