Pass value from unbound textbox (dlookup) to bound textbox (both on same form)
Posted on 2005-03-10
I pull a value from a query via Dlookup (unbound textbox). That value consistently changes. Whatever the current value is shown in the Dlookup textbox, I need to now pass it to a bound textbox and store in a table.
I tried several events in the Dlookup control (AfterUpdate, OnChange, etc.)... the bound textbox doesn't show the value. I also tried to put an update event in yet another textbox in a subform. Essentially it is that other textbox that will change the value in the query hence the value in the Dlookup.
I placed something like this in the AfterUpdate event of the subform textbox (again, the "driver textbox")...
Me.BoundTextBoxThatMustReceiveTheData.Value = Me.ControlNameofDlookup
Me.BoundTextBoxThatMustReceiveTheData.Value = Dlookup(function...)
I then put a break in the AfterUpdate event... "Me.BoundTextBoxThatMustReceiveTheData.Value" shows the proper value in VBA, but again, once back in form view, it does hold/store the data.
What am I doing wrong?