-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Assuming the user had put the cursor in the control they wanted to
search, in the Command Button OnClick event put this:
dim ctl as control
set ctl = screen.previouscontrol
ctl.setfocus
Or if you know the control you want the search to be on just indicate
that control:
Me!SearchTextBox.SetFocus
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRAkBFoechKqOuFEgEQJBgwCgiiDl8qedn4WSsnYdl3i9Wj YfgjYAnA5o
Cg3iC0IvY2MT7EnRoY9wYNxV
=GtQz
-----END PGP SIGNATURE-----
Alex Chun wrote:
This works, except that the command button -- which is unsearchable -- now
has the focus. Is there an easy way to program the button to search the
field that the cursor was in?
Thanks again.
Alex
"MGFoster" <me@privacy.com> wrote in message
news:9T***************@newsread1.news.pas.earthlin k.net...
Alex Chun wrote:
How can I program a command button on a form to bring up the standard
"Find and Replace" dialog on click?
Separate but related: how do you run menu commands (e.g. "Edit" "Find")
from VB?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Answer to both questions: use the RunCommand method of the DoCmd
object. E.g.:
DoCmd.RunCommand acCmdFind
The cursor has to be in the control you want to search.
See the VBA Help article on RunCommand for a list of other "menu"
commands available thru RunCommand.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRAiqV4echKqOuFEgEQJzwACfSo0pZmYX2dfYEgGsfUC1a1 6weXUAn2Z0
vVgzUoZM/4I8VAa0GAg+eYY/
=wa69
-----END PGP SIGNATURE-----