search problem

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

Guest

Hi,
I've got a text box and a list. When I type something in a text box and
press enter list box updates cause list boxes row source sql has the text box
value included in where section of sql. Thant works fine.
How can I achive the same but without having to press enter in the end
after I typed string. I want list to update with every next key pressed.
thanx

alek_mil
 
Use the control's OnChange event instead of the AfterUpdate event.
 
Infact the more I think it's not a solution at all. Change event occurs
before any update events so all those keys typed are not visible (in user
interface yes, but from coden no) before enter.

So the right question how to see (from code) string in text box that has not
been updated yet (dirty).

alek_mil
 
Use the text box's Text property to feed your SQL statement. So, instead of:
"SELECT ... FROM ... WHERE [Field]='" & [Forms]![MyForm]![txtSearch] & "';"
you'd have:
"SELECT ... FROM ... WHERE [Field]='" & [Forms]![MyForm]![txtSearch].Text &
"';"

If you don't want to use the OnChange event, you can use KeyUp, create a
Timer event, and/or force the record to save first:
DoCmd.RunCommand acCmdSaveRecord
 
Back
Top