how do I refresh a query in a textbox

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

Guest

Hi,

I have a textbox on a form and the data displayed is from a table by using
dlookup. I want the text box to refresh each time the new data is entered in
the table. It works only when I load the form. I want whent he form is
activate.

Pls advice in this pls.
 
If the DLookUp set on the control source of the text box, you can put on the
OnActivate event of the form

Me.TextBoxName.Requery

That should run the Dlookup again
 
Ofer, how do I get to the OnActivate event? What do I actually need to do to
put an event on the form? Am I putting the event on the original form or the
one containing the info for the textbox?
 
Hi Jennifer,

you really should make it a habit to reply within the existing thread so
that the person who is helping you can see your post.

That said, you need to open your form in design view and bring up its
property sheet.

Click the "EVENTS" tab
Click on the line "On Activate"
Click the dropdown arrow
Select [Event Procedure]
Click the ellipse (...)
Insert the text: Me.TextBoxName.Requery on a blank line between Private Sub
Form_Activate() and End Sub
Obviously, you need to adjust this with the name of your text box.

HTH,
Brian
 
Back
Top