how do I update a field in a table thru a dlookup in a unbound txt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have form with listbox, subform and an unbounded txtbox.

When a user clicks on a listbox, it'll fill out subform and txtbox
(txtbox control source using dlookup). Txtbox pulls up info from the table
just fine, but users are unable to edit - "control can't be edited; it's
bound to the expression 'Dlookup(.....)'.
Is there a way to work around it?

Thanks,
 
If the form where the text box is unbound, then bound it to the table you
using for the dlookup, filter the recordsource to the list box for the
filter, and on the after update event of the list box, run the code
me.requery.
Bound the text box to the field, and now you can edit it, the requery will
bring the right value.

Or
On the after update event of the list box write,
me.textboxname = dlookup()
and leave the text box unbound, on the after update event of the text box
run an update sql to update the table
 
Back
Top