J
John Keith
Property ctl.Value not set when...Pressing Enter
The form I am working with is a search routine using unbound text boxes in
the header for the criteria. I have set up the form to detect keypresses:
Enter or Esc in the Form_Keydown routine and call the search routine that is
stored in a cmdFilter_Click (or the cmdReset_Click for the Esc key)
I think what is happening is that the KeyDown event is firing before the
search text has been registered into the .Value propery of the control.
Because, If I press Enter again after no search critera were recognized, the
routine then sees the .value just fine. Also, if I enter the value in the
search box and then use the mouse to click the cmdFilter button, the routine
works just fine.
So, Is there a way to force the entered text to update the control as the
Keydown routine fires? OR what is another way to make the enter key run the
search.
Perhaps using the form level keydown is too early and should be moved... to
where? The help files had suggested this to avoid having to code every
control with a set of key press dection routines.
The form I am working with is a search routine using unbound text boxes in
the header for the criteria. I have set up the form to detect keypresses:
Enter or Esc in the Form_Keydown routine and call the search routine that is
stored in a cmdFilter_Click (or the cmdReset_Click for the Esc key)
I think what is happening is that the KeyDown event is firing before the
search text has been registered into the .Value propery of the control.
Because, If I press Enter again after no search critera were recognized, the
routine then sees the .value just fine. Also, if I enter the value in the
search box and then use the mouse to click the cmdFilter button, the routine
works just fine.
So, Is there a way to force the entered text to update the control as the
Keydown routine fires? OR what is another way to make the enter key run the
search.
Perhaps using the form level keydown is too early and should be moved... to
where? The help files had suggested this to avoid having to code every
control with a set of key press dection routines.